content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Goals: """Represents scenario goals Attributes: conquest (int): 1 conquest unknown1 (int): unknown relics (int): number of relics required unknown2 (int): unknown exploration (int): map exploratino required in % all (int): all conditions mode (int)...
class Goals: """Represents scenario goals Attributes: conquest (int): 1 conquest unknown1 (int): unknown relics (int): number of relics required unknown2 (int): unknown exploration (int): map exploratino required in % all (int): all conditions mode (int):...
def findLargest(l): lo , hi = 0 , len(l) left , right = l[0] , l[-1] while(lo<hi): mid = (lo + hi)//2 if(left > l[mid]): hi = mid else: lo = mid +1 return l[lo-1]
def find_largest(l): (lo, hi) = (0, len(l)) (left, right) = (l[0], l[-1]) while lo < hi: mid = (lo + hi) // 2 if left > l[mid]: hi = mid else: lo = mid + 1 return l[lo - 1]
def rule(event): # Only check actions creating a new Network ACL entry if event['eventName'] != 'CreateNetworkAclEntry': return False # Check if this new NACL entry is allowing traffic from anywhere return (event['requestParameters']['cidrBlock'] == '0.0.0.0/0' and event['requestPar...
def rule(event): if event['eventName'] != 'CreateNetworkAclEntry': return False return event['requestParameters']['cidrBlock'] == '0.0.0.0/0' and event['requestParameters']['ruleAction'] == 'allow' and (event['requestParameters']['egress'] is False)
_base_ = [ './coco_data_pipeline.py' ] model = dict( type='MaskRCNN', backbone=dict( type='efficientnet_b2b', out_indices=(2, 3, 4, 5), frozen_stages=-1, pretrained=True, activation_cfg=dict(type='torch_swish'), norm_cfg=dict(type='BN', requires_grad=True)), ...
_base_ = ['./coco_data_pipeline.py'] model = dict(type='MaskRCNN', backbone=dict(type='efficientnet_b2b', out_indices=(2, 3, 4, 5), frozen_stages=-1, pretrained=True, activation_cfg=dict(type='torch_swish'), norm_cfg=dict(type='BN', requires_grad=True)), neck=dict(type='FPN', in_channels=[24, 48, 120, 352], out_channel...
class LayoutSettings(object): """ Provides a base class for collecting layout scheme characteristics. """ LayoutEngine=property(lambda self: object(),lambda self,v: None,lambda self: None) """Gets the current table layout engine. Get: LayoutEngine(self: LayoutSettings) -> LayoutEngine """
class Layoutsettings(object): """ Provides a base class for collecting layout scheme characteristics. """ layout_engine = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Gets the current table layout engine.\n\n\n\nGet: LayoutEngine(self: LayoutSettings) -> LayoutEngine\n\n\n\n'
def main() -> None: x0, y0 = map(int, input().split()) x1, y1 = map(int, input().split()) x2, y2 = map(int, input().split()) def calc(x0, y0, x1, y1, x2, y2): if y2 == y0: print(x2, y1) else: print(x2, y0) if x0 == x1: calc(x0, y0, x1, y1...
def main() -> None: (x0, y0) = map(int, input().split()) (x1, y1) = map(int, input().split()) (x2, y2) = map(int, input().split()) def calc(x0, y0, x1, y1, x2, y2): if y2 == y0: print(x2, y1) else: print(x2, y0) if x0 == x1: calc(x0, y0, x1, y1, x2, y...
class FreqStack: def __init__(self): self.fmap = Counter() self.stack = [0] def push(self, x: int) -> None: self.fmap[x] += 1 freq = self.fmap[x] if (freq == len(self.stack)): self.stack.append([x]) else: self.stack[freq].append(x) def pop(self) -> int: ...
class Freqstack: def __init__(self): self.fmap = counter() self.stack = [0] def push(self, x: int) -> None: self.fmap[x] += 1 freq = self.fmap[x] if freq == len(self.stack): self.stack.append([x]) else: self.stack[freq].append(x) def...
input_1 = int(input('Ingrese numero 1 = ')) input_2 = int(input('Ingrese numero 2 = ')) for x in range(input_1, input_2): print(x)
input_1 = int(input('Ingrese numero 1 = ')) input_2 = int(input('Ingrese numero 2 = ')) for x in range(input_1, input_2): print(x)
CERTIFICATE = { "type": "service_account", "project_id": "fir-orm-python", "private_key_id": "47246fe582a99774f4daf19fad21b97a09df8c70", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDMp79d08KEZPrn\nN0xZGULfM/eZwAJ+MytsPQhs+LVSqtx1c/oGHpQC5GiW9xwgnMpEh7xfX5NNjp6x...
certificate = {'type': 'service_account', 'project_id': 'fir-orm-python', 'private_key_id': '47246fe582a99774f4daf19fad21b97a09df8c70', 'private_key': '-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDMp79d08KEZPrn\nN0xZGULfM/eZwAJ+MytsPQhs+LVSqtx1c/oGHpQC5GiW9xwgnMpEh7xfX5NNjp6x\n0BVP9e7...
MODEL_PATH = { "glove": "phrase-emb-storage/saved_models/glove/", "bert": "bert-base-uncased", "spanbert": "phrase-emb-storage/saved_models/span-bert-model/", "sentbert": "bert-base-nli-stsb-mean-tokens", "phrase-bert": "phrase-emb-storage/saved_models/phrase-bert-model/" } GLOVE_FILE_PATH = 'phra...
model_path = {'glove': 'phrase-emb-storage/saved_models/glove/', 'bert': 'bert-base-uncased', 'spanbert': 'phrase-emb-storage/saved_models/span-bert-model/', 'sentbert': 'bert-base-nli-stsb-mean-tokens', 'phrase-bert': 'phrase-emb-storage/saved_models/phrase-bert-model/'} glove_file_path = 'phrase-emb-storage/cc_glove/...
if __name__ == '__main__': mark = [] for _ in range(int(input())): name = input() score = float(input()) mark.append([name, score]) second_highest = sorted(set([score for name, score in mark]))[1] print('\n'.join(sorted([name for name, score in mark if score == second_highes...
if __name__ == '__main__': mark = [] for _ in range(int(input())): name = input() score = float(input()) mark.append([name, score]) second_highest = sorted(set([score for (name, score) in mark]))[1] print('\n'.join(sorted([name for (name, score) in mark if score == second_highest...
""" HackerRank - Algorithms - Implementation Kangaroo """ #!/bin/python3 x1, v1, x2, v2 = input().strip().split(" ") x1, v1, x2, v2 = [int(x1), int(v1), int(x2), int(v2)] if ( v1 != v2 and (x1 - x2) % (v2 - v1) == 0 and (x1 - x2) / (v2 - v1) > 0 ): # Takes care of zero devision print("YES") else: print(...
""" HackerRank - Algorithms - Implementation Kangaroo """ (x1, v1, x2, v2) = input().strip().split(' ') (x1, v1, x2, v2) = [int(x1), int(v1), int(x2), int(v2)] if v1 != v2 and (x1 - x2) % (v2 - v1) == 0 and ((x1 - x2) / (v2 - v1) > 0): print('YES') else: print('NO')
# optimizer optimizer = dict(type='Lamb', lr=0.005, weight_decay=0.02) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='CosineAnnealing', min_lr=1.0e-6, warmup='linear', # For ImageNet-1k, 626 iters per epoch, warmup 5 epochs. warmup_iters=5 * 626, warmup_ratio...
optimizer = dict(type='Lamb', lr=0.005, weight_decay=0.02) optimizer_config = dict(grad_clip=None) lr_config = dict(policy='CosineAnnealing', min_lr=1e-06, warmup='linear', warmup_iters=5 * 626, warmup_ratio=0.0001) runner = dict(type='EpochBasedRunner', max_epochs=100)
""" This module provides functionality to work with images """ def overlay(background_image, foreground_image, x_offset, y_offset): """ Overlays a png image on another image. :param background_image: OpenCv image to be overlaid with foreground image :param foreground_image: OpenCv image to overlay ...
""" This module provides functionality to work with images """ def overlay(background_image, foreground_image, x_offset, y_offset): """ Overlays a png image on another image. :param background_image: OpenCv image to be overlaid with foreground image :param foreground_image: OpenCv image to overlay ...
{ "targets": [ { "target_name": "ultradb", "sources": [ "src/ultradb.cc" ], "conditions": [ ["OS==\"linux\"", { "cflags_cc": [ "-fpermissive", "-Os" ] }] ] } ] }
{'targets': [{'target_name': 'ultradb', 'sources': ['src/ultradb.cc'], 'conditions': [['OS=="linux"', {'cflags_cc': ['-fpermissive', '-Os']}]]}]}
VBA = \ r""" Function Base64ToStream(b) Dim enc, length, ba, transform, ms Set enc = CreateObject("System.Text.ASCIIEncoding") length = enc.GetByteCount_2(b) Set transform = CreateObject("System.Security.Cryptography.FromBase64Transform") Set ms = CreateObject("System.IO.MemoryStream") ms.Write transf...
vba = '\n\n\n\nFunction Base64ToStream(b)\n Dim enc, length, ba, transform, ms\n Set enc = CreateObject("System.Text.ASCIIEncoding")\n length = enc.GetByteCount_2(b)\n Set transform = CreateObject("System.Security.Cryptography.FromBase64Transform")\n Set ms = CreateObject("System.IO.MemoryStream")\n ms.Write tran...
class Solution: def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ s=s.strip() if len(s)==0: return 0 return len((s.split(" "))[-1])
class Solution: def length_of_last_word(self, s): """ :type s: str :rtype: int """ s = s.strip() if len(s) == 0: return 0 return len(s.split(' ')[-1])
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # # Licensed under the Apache Licen...
"""Power state is the state we get by calling virt driver on a particular domain. The hypervisor is always considered the authority on the status of a particular VM, and the power_state in the DB should be viewed as a snapshot of the VMs's state in the (recent) past. It can be periodically updated, and should also be u...
DEBUG = False SQLALCHEMY_DATABASE_URI = 'postgresql:///logging' PORT = 5555 SERVER = 'production' #SSL_KEY = "/path/to/keyfile.key" #SSL_CRT = "/path/to/certfile.crt"
debug = False sqlalchemy_database_uri = 'postgresql:///logging' port = 5555 server = 'production'
# Event: LCCS Python Fundamental Skills Workshop # Date: Dec 2018 # Author: Joe English, PDST # eMail: computerscience@pdst.ie # Breakout 6.4 Check digits # Solution to Exercise 1 - extract the ith digit from n # A function to extract digit i from number n def extractDigit(i, n): i = len(n) - i if i ...
def extract_digit(i, n): i = len(n) - i if i < 0: return -1 n = int(n) return n // pow(10, i) % 10 x = input('Enter a number: ') pos = int(input('Enter position of digit to extract: ')) print(extract_digit(pos, x)) '\nn = int(input("Enter a 2 digit number: "))\nd2 = n%10 # %10 extracts the...
st=input() k=list(st) print(k) def equal(s): n=len(s) sh=0 tr=0 for i in s: if(i=='s'): sh+=1 if(i=='t'): tr+=1 if(sh==tr): return 1 else: return 0 def equal_s_t(st): maxi=0 n=len(st) for i in range(n): for j in range(i,n): if(equal(st[i:j+1])...
st = input() k = list(st) print(k) def equal(s): n = len(s) sh = 0 tr = 0 for i in s: if i == 's': sh += 1 if i == 't': tr += 1 if sh == tr: return 1 else: return 0 def equal_s_t(st): maxi = 0 n = len(st) for i in range(n): ...
""" .. module: onacol.base :synopsis: Basic utilities and exception classes. .. moduleauthor:: Josef Nevrly <josef.nevrly@gmail.com> """ class OnacolException(Exception): pass
""" .. module: onacol.base :synopsis: Basic utilities and exception classes. .. moduleauthor:: Josef Nevrly <josef.nevrly@gmail.com> """ class Onacolexception(Exception): pass
def linha(): print() print('=' * 80) print() linha() num = 0 soma = 0 cont = 0 while not num == 999: num = int(input('Valor: ')) if num != 999: soma += num cont += 1 print() print(f'Valores digitados: {cont}') print(f'Soma dos valores: {soma}') linha()
def linha(): print() print('=' * 80) print() linha() num = 0 soma = 0 cont = 0 while not num == 999: num = int(input('Valor: ')) if num != 999: soma += num cont += 1 print() print(f'Valores digitados: {cont}') print(f'Soma dos valores: {soma}') linha()
CDNX_POS_PERMISSIONS = { 'operator': [ 'list_subcategory', 'list_productfinal', 'list_productfinaloption', ], }
cdnx_pos_permissions = {'operator': ['list_subcategory', 'list_productfinal', 'list_productfinaloption']}
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
class Configurationmapping: def __init__(self): self.type = None self.class_name = None self.properties = None self.module_name = None def __getstate__(self): state = self.__dict__.copy() return state def __setstate__(self, state): self.__dict__.upd...
#!/usr/bin/python3 def multiple_returns(sentence): if len(sentence) == 0: return (0, None) return (len(sentence), sentence[0])
def multiple_returns(sentence): if len(sentence) == 0: return (0, None) return (len(sentence), sentence[0])
#Instructions #Create an empty list named misspelled_words. #Write a for loop that: #iterates over tokenized_story, #uses an if statement that returns True if the current token is not in tokenized_vocabulary and if so, appends the current token to misspelled_words. #Print misspelled_words. #In this code, we're going t...
def clean_text(text_string, special_characters): cleaned_string = text_string for string in special_characters: cleaned_string = cleaned_string.replace(string, '') cleaned_string = cleaned_string.lower() return cleaned_string def tokenize(text_string, special_characters): cleaned_story = cl...
# slicing # my_list[start_index:end_index] # my_list[:] # This would be all of the items in my_list # my_list[:5] # This would be the items from index 0 to 4 # my_list[5:] # This would be the items from index 5 to the end of the list # guided """ Given an array of integers `nums`, define a function that returns the...
""" Given an array of integers `nums`, define a function that returns the "pivot" index of the array. The "pivot" index is where the sum of all the numbers on the left of that index is equal to the sum of all the numbers on the right of that index. If the input array does not have a "pivot" index, then the function sho...
def escreva(texto): print('~' * (len(texto) + 4)) print(f' {texto}') print('~' * (len(texto) + 4)) # Programa Principal text = str(input('Digite: ')) escreva(text) escreva('Gustavo Guanabara') escreva('Curso de Python no Youtube') escreva('CeV')
def escreva(texto): print('~' * (len(texto) + 4)) print(f' {texto}') print('~' * (len(texto) + 4)) text = str(input('Digite: ')) escreva(text) escreva('Gustavo Guanabara') escreva('Curso de Python no Youtube') escreva('CeV')
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include".split(';') if "/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include" != "" else [] PROJECT_CATKIN_DEPENDS = "".re...
catkin_package_prefix = '' project_pkg_config_include_dirs = '/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include'.split(';') if '/home/shams3049/catkin_ws/install/include;/usr/local/cuda-9.0/include' != '' else [] project_catkin_depends = ''.replace(';', ' ') pkg_config_libraries_with_prefix = '-lkin...
def normalize( self, values, ): """Normalizes axis values Parameters ---------- self: Norm_ref a Norm_ref object values: ndarray axis values Returns ------- Vector of axis values """ return values / self.ref
def normalize(self, values): """Normalizes axis values Parameters ---------- self: Norm_ref a Norm_ref object values: ndarray axis values Returns ------- Vector of axis values """ return values / self.ref
PY_WRAPPER = """ import dash import dash_bootstrap_components as dbc app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP]) {snippet} app.layout = html.Div([{components}]) """ R_WRAPPER = """ library(dash) library(dashBootstrapComponents) library(dashHtmlComponents) app <- Dash$new(external_stylesheets = dbc...
py_wrapper = '\nimport dash\nimport dash_bootstrap_components as dbc\n\napp = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])\n\n{snippet}\n\napp.layout = html.Div([{components}])\n' r_wrapper = '\nlibrary(dash)\nlibrary(dashBootstrapComponents)\nlibrary(dashHtmlComponents)\n\napp <- Dash$new(external_stylesheet...
""" 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 """ n= int(input()) for i in range(n): for j in range(0,n-i): print(" ",end=' ') for j in range(i+1): if j<i: print(i+1,end=" ") else: print(i+1,end="") if i<n: print() ...
""" 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 """ n = int(input()) for i in range(n): for j in range(0, n - i): print(' ', end=' ') for j in range(i + 1): if j < i: print(i + 1, end=' ') else: print(i + 1, end='') if i < n: print()
''' .remove(x) This operation removes element from the set. If element does not exist, it raises a KeyError. The .remove(x) operation returns None. Example >>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> s.remove(5) >>> print s set([1, 2, 3, 4, 6, 7, 8, 9]) >>> print s.remove(4) None >>> print s set([1, 2, 3, 6, 7, 8...
""" .remove(x) This operation removes element from the set. If element does not exist, it raises a KeyError. The .remove(x) operation returns None. Example >>> s = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> s.remove(5) >>> print s set([1, 2, 3, 4, 6, 7, 8, 9]) >>> print s.remove(4) None >>> print s set([1, 2, 3, 6, 7, 8...
ERR_SUCCESSFUL = 0 ERR_AUTHENTICATION_FAILED = 1 ERR_DUPLICATE_MODEL = 2 ERR_DOT_NOT_EXIST = 3 ERR_PERMISSION_DENIED = 4 ERR_INVALID_CREDENTIALS = 5 ERR_AUTHENTICATION_FAILED = 6 ERR_USER_IS_INACTIVE = 7 ERR_NOT_AUTHENTICATED = 8 ERR_INPUT_VALIDATION = 9 ERR_PARSE = 10 ERR_UNSUPPORTED_MEDIA = 11 ERR_METHOD_NOT_ALLOWED ...
err_successful = 0 err_authentication_failed = 1 err_duplicate_model = 2 err_dot_not_exist = 3 err_permission_denied = 4 err_invalid_credentials = 5 err_authentication_failed = 6 err_user_is_inactive = 7 err_not_authenticated = 8 err_input_validation = 9 err_parse = 10 err_unsupported_media = 11 err_method_not_allowed ...
class CompteBancaire(): """ Gestion des Banques """ def __init__(self, nom = 'Dupont', solde = 1000 ): """ constructeur """ self.nom = nom self.solde = solde def depot(self, somme): """ ajouter somme au solde """ self...
class Comptebancaire: """ Gestion des Banques """ def __init__(self, nom='Dupont', solde=1000): """ constructeur """ self.nom = nom self.solde = solde def depot(self, somme): """ ajouter somme au solde """ self.solde = self.so...
# Bottom-Up Dynamic Programming (Tabulation) class Solution: def minCostClimbingStairs(self, cost: list[int]) -> int: # The array's length should be 1 longer than the length of cost # This is because we can treat the "top floor" as a step to reach minimum_cost = [0] * (len(cost) + 1) ...
class Solution: def min_cost_climbing_stairs(self, cost: list[int]) -> int: minimum_cost = [0] * (len(cost) + 1) for i in range(2, len(cost) + 1): take_one_step = minimum_cost[i - 1] + cost[i - 1] take_two_steps = minimum_cost[i - 2] + cost[i - 2] minimum_cost[i]...
nterms = int(input()) n1=0 n2=1 count=0 if nterms <= 0: print("please enter a positive integer") elif nterms==1: print("Fibonacci sequence upto",nterms,":") print(n1) else: print("Fibonacci sequence:") while count < nterms: print(n1) nth=n1+n2 n1=n2 n2=nth co...
nterms = int(input()) n1 = 0 n2 = 1 count = 0 if nterms <= 0: print('please enter a positive integer') elif nterms == 1: print('Fibonacci sequence upto', nterms, ':') print(n1) else: print('Fibonacci sequence:') while count < nterms: print(n1) nth = n1 + n2 n1 = n2 n2...
class Solution: def maxProfit(self, k, prices): """ :type k: int :type prices: List[int] :rtype: int """ n = len(prices) if n == 0: return 0 if k >= n // 2: return sum(max(0, prices[i + 1] - prices[i]) for i in range(n - 1)) ...
class Solution: def max_profit(self, k, prices): """ :type k: int :type prices: List[int] :rtype: int """ n = len(prices) if n == 0: return 0 if k >= n // 2: return sum((max(0, prices[i + 1] - prices[i]) for i in range(n - 1)))...
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Parcel lifted index (to 500 hPa)', 'units': 'K'}, {'abbr': 1, 'code': 1, 'title': 'Best lifted index (to 500 hPa)', 'units': 'K'}, {'abbr': 2, 'code': 2, 'title...
def load(h): return ({'abbr': 0, 'code': 0, 'title': 'Parcel lifted index (to 500 hPa)', 'units': 'K'}, {'abbr': 1, 'code': 1, 'title': 'Best lifted index (to 500 hPa)', 'units': 'K'}, {'abbr': 2, 'code': 2, 'title': 'K index', 'units': 'K'}, {'abbr': 3, 'code': 3, 'title': 'KO index', 'units': 'K'}, {'abbr': 4, 'c...
# channel.py # ~~~~~~~~~ # This module implements the Channel class. # :authors: Justin Karneges, Konstantin Bokarius. # :copyright: (c) 2015 by Fanout, Inc. # :license: MIT, see LICENSE for more details. # The Channel class is used to represent a channel in a GRIP proxy and # tracks the previous ID ...
class Channel(object): def __init__(self, name, prev_id=None): self.name = name self.prev_id = prev_id self.filters = []
def main(): st = input("") print(min(st)) main()
def main(): st = input('') print(min(st)) main()
def sum_of_digits(digits) -> str: if not str(digits).isdecimal(): return '' else: return f'{" + ".join([i for i in str(digits)])} = {sum([int(i) for i in str(digits)])}'
def sum_of_digits(digits) -> str: if not str(digits).isdecimal(): return '' else: return f"{' + '.join([i for i in str(digits)])} = {sum([int(i) for i in str(digits)])}"
"""Constants for the FiveM integration.""" ATTR_PLAYERS_LIST = "players_list" ATTR_RESOURCES_LIST = "resources_list" DOMAIN = "fivem" ICON_PLAYERS_MAX = "mdi:account-multiple" ICON_PLAYERS_ONLINE = "mdi:account-multiple" ICON_RESOURCES = "mdi:playlist-check" MANUFACTURER = "Cfx.re" NAME_PLAYERS_MAX = "Players Max"...
"""Constants for the FiveM integration.""" attr_players_list = 'players_list' attr_resources_list = 'resources_list' domain = 'fivem' icon_players_max = 'mdi:account-multiple' icon_players_online = 'mdi:account-multiple' icon_resources = 'mdi:playlist-check' manufacturer = 'Cfx.re' name_players_max = 'Players Max' name...
str = 'Hello World!' print(str) # Prints complete string print(str[0]) # Prints first character of the string print(str[2:5]) # Prints characters starting from 3rd to 5th print(str[2:]) # Prints string starting from 3rd character print(str * 2) # Prints string two times print(str + "TEST") ...
str = 'Hello World!' print(str) print(str[0]) print(str[2:5]) print(str[2:]) print(str * 2) print(str + 'TEST')
#D&D D12 die with 12 pentagonal faces af = 7 textH = 2 textD = 0.3 faces = {"1":(0,0), "2":(60,72), "3":(60,72*2), "4":(60,72*3), "5":(60,72*4), "6":(60,0), "C":(180,0),"B":(120,72*3+36),"A":(120,72*4+36),"9":(120,36),"8":(120,72+36),"7":(120,72*2+36)} a = cq.Workplane("XY").sphere(5) for ...
af = 7 text_h = 2 text_d = 0.3 faces = {'1': (0, 0), '2': (60, 72), '3': (60, 72 * 2), '4': (60, 72 * 3), '5': (60, 72 * 4), '6': (60, 0), 'C': (180, 0), 'B': (120, 72 * 3 + 36), 'A': (120, 72 * 4 + 36), '9': (120, 36), '8': (120, 72 + 36), '7': (120, 72 * 2 + 36)} a = cq.Workplane('XY').sphere(5) for k in faces.keys()...
load("//:compile.bzl", "ProtoCompileInfo") RustProtoLibInfo = provider(fields = { "name": "rule name", "lib": "lib.rs file", }) def _basename(f): return f.basename[:-len(f.extension) - 1] def _rust_proto_lib_impl(ctx): """Generate a lib.rs file for the crates.""" compilation = ctx.attr.compilatio...
load('//:compile.bzl', 'ProtoCompileInfo') rust_proto_lib_info = provider(fields={'name': 'rule name', 'lib': 'lib.rs file'}) def _basename(f): return f.basename[:-len(f.extension) - 1] def _rust_proto_lib_impl(ctx): """Generate a lib.rs file for the crates.""" compilation = ctx.attr.compilation[ProtoComp...
# noinspection PyUnusedLocal # friend_name = unicode string def hello(friend_name): """ Says hello world param[0] = a String. Ignore for now. @return = a String containing a message """ return "Hello, {}!".format(friend_name)
def hello(friend_name): """ Says hello world param[0] = a String. Ignore for now. @return = a String containing a message """ return 'Hello, {}!'.format(friend_name)
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # ! Please change the following two path strings to you own one ! # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ELINA_PYTHON_INTERFACE_PATH = '/home/xxxxx/pkgs/ELINA/python_interface' DEEPG_CODE_PATH = '/home/xxxxx/pkgs/deepg/code' ...
elina_python_interface_path = '/home/xxxxx/pkgs/ELINA/python_interface' deepg_code_path = '/home/xxxxx/pkgs/deepg/code' norm_types = ['0', '1', '2', 'inf'] datasets = ['imagenet', 'cifar10', 'mnist'] method_list = ['Clean', 'PGD', 'CW', 'MILP', 'FastMILP', 'PercySDP', 'FazlybSDP', 'AI2', 'RefineZono', 'LPAll', 'kReLU',...
def FlagsForFile( filename ): return { 'flags': [ '-Wall', '-Wextra', '-Werror', '-std=c++11', '-x', 'c++', '-isystem', '/usr/include/c++/10', '-isystem', '/usr/include/c++/10/backward', '-isystem', '/usr/local/include', '-isystem', '/usr/include', ] }
def flags_for_file(filename): return {'flags': ['-Wall', '-Wextra', '-Werror', '-std=c++11', '-x', 'c++', '-isystem', '/usr/include/c++/10', '-isystem', '/usr/include/c++/10/backward', '-isystem', '/usr/local/include', '-isystem', '/usr/include']}
# Resources # https://www.geeksforgeeks.org/observer-method-python-design-patterns/ # https://docs.google.com/document/d/1jyrxxQyrVxBG9S_hXYI69ytUMdxQdApyM6MO2CwvYj4/edit class Subject: """Represents what is being observed""" def __init__(self): """create an empty observer list""" self._obser...
class Subject: """Represents what is being observed""" def __init__(self): """create an empty observer list""" self._observers = [] def notify(self, measurements=None): """Alert the observers""" for observer in self._observers: if measurements != observer: ...
class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. 1,2,3,4,5 3 3,4,5,1,2 """ move = k % len(nums) nums[:] = nums[-move:] + nums[:-move]
class Solution: def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. 1,2,3,4,5 3 3,4,5,1,2 """ move = k % len(nums) nums[:] = nums[-move:] + nums[:-move]
def increaseNumberRoundness(n): gotToSignificant = False while n > 0: if n % 10 == 0 and gotToSignificant: return True elif n % 10 != 0: gotToSignificant = True n /= 10 return False
def increase_number_roundness(n): got_to_significant = False while n > 0: if n % 10 == 0 and gotToSignificant: return True elif n % 10 != 0: got_to_significant = True n /= 10 return False
fname = input('please enter a file name: ') fhand = open('romeo.txt') new_list = list() for line in fhand: word = line.split() for element in word: if element not in new_list: new_list.append(element) new_list.sort() print(new_list)
fname = input('please enter a file name: ') fhand = open('romeo.txt') new_list = list() for line in fhand: word = line.split() for element in word: if element not in new_list: new_list.append(element) new_list.sort() print(new_list)
# Copyright 2015-2018 Camptocamp SA, Damien Crier # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Colorize field in tree views", "summary": "Allows you to dynamically color fields on tree views", "category": "Hidden/Dependency", "version": "14.0.1.0.0", "depends": ["w...
{'name': 'Colorize field in tree views', 'summary': 'Allows you to dynamically color fields on tree views', 'category': 'Hidden/Dependency', 'version': '14.0.1.0.0', 'depends': ['web'], 'author': 'Camptocamp, Therp BV, Odoo Community Association (OCA)', 'license': 'AGPL-3', 'website': 'https://github.com/OCA/web', 'dem...
# EDA: Target - Q1 print("Number of unique cities in the data set:\n", df_tar['Target City'].nunique()) print("---------------------------------------") most_frequent_cities = df_tar['Target City'].value_counts().sort_values(ascending=False)[:15] print("Most frequent cities:\n", most_frequent_cities) print("----------...
print('Number of unique cities in the data set:\n', df_tar['Target City'].nunique()) print('---------------------------------------') most_frequent_cities = df_tar['Target City'].value_counts().sort_values(ascending=False)[:15] print('Most frequent cities:\n', most_frequent_cities) print('------------------------------...
class ScreenIdError(ValueError): pass class UssdNamespaceError(RuntimeError): pass
class Screeniderror(ValueError): pass class Ussdnamespaceerror(RuntimeError): pass
def matchParenthesis(string): parenthesis = 0 brackets = 0 curlyBrackets = 0 for i in range(len(string)): l = string[i] if l == '(': if i > 0: if not string[i-1] == ':' and not string[i-1] == ';': parenthesis += 1 else: ...
def match_parenthesis(string): parenthesis = 0 brackets = 0 curly_brackets = 0 for i in range(len(string)): l = string[i] if l == '(': if i > 0: if not string[i - 1] == ':' and (not string[i - 1] == ';'): parenthesis += 1 else: ...
_base_ = [ '../_base_/datasets/imagenet_bs128.py', '../_base_/schedules/imagenet_bs1024.py', '../_base_/default_runtime.py' ] model = dict( type='ImageClassifier', backbone=dict( type='ResArch', arch='IRNet-18', num_stages=4, out_indices=(1,2,3), styl...
_base_ = ['../_base_/datasets/imagenet_bs128.py', '../_base_/schedules/imagenet_bs1024.py', '../_base_/default_runtime.py'] model = dict(type='ImageClassifier', backbone=dict(type='ResArch', arch='IRNet-18', num_stages=4, out_indices=(1, 2, 3), style='pytorch'), neck=dict(type='MultiLevelFuse', in_channels=[128, 256, 5...
""" docstring """ def exp_lr(optimizer, epoch, init_lr=1e-3, lr_decay_epoch=30): """ Decay learning rate as epochs progress. Parameters: ---------- optimizer: torch.optim optimizer class epoch: int init_lr: float initial learning rate lr_decay_epoch: int number of epoch...
""" docstring """ def exp_lr(optimizer, epoch, init_lr=0.001, lr_decay_epoch=30): """ Decay learning rate as epochs progress. Parameters: ---------- optimizer: torch.optim optimizer class epoch: int init_lr: float initial learning rate lr_decay_epoch: int number of epoc...
a = 2 b = 0 try: print(a/b) except ZeroDivisionError: print('Division by zero is not allowed')
a = 2 b = 0 try: print(a / b) except ZeroDivisionError: print('Division by zero is not allowed')
# Problem Set 2, Question 3 # These hold the values of the balance. balance = 320000 origBalance = balance # These hold the values of the annual and monthly interest rates. annualInterestRate = 0.2 monthlyInterestRate = annualInterestRate / 12 lowerBound = balance / 12 upperBound = (balance * (1 + monthlyInterestRat...
balance = 320000 orig_balance = balance annual_interest_rate = 0.2 monthly_interest_rate = annualInterestRate / 12 lower_bound = balance / 12 upper_bound = balance * (1 + monthlyInterestRate) ** 12 / 12.0 while abs(balance) > 0.01: balance = origBalance payment = (upperBound - lowerBound) / 2 + lowerBound f...
# Advent of code 2018 # Antti "Waitee" Auranen # Day 4 # Example of the datetime part of the logs: # [1518-10-12 00:15] # # Examples of the message part of the logs: # Guard #1747 begins shift # falls asleep # wakes up def main(): inputs = [] guards = [] while(True): s = input("> ") #sp...
def main(): inputs = [] guards = [] while True: s = input('> ') if len(s) > 0: line = (s[1:17], s[19:]) inputs.append(line) else: break inputs = quick_sort(inputs) for a in inputs: if a[1][:5] == 'Guard': guard = a[1][s....
class Solution: def validMountainArray(self, arr: List[int]) -> bool: if len(arr) < 3: return False steps = 0 # Walk upwards, counting steps until first slope down while steps + 1 < len(arr) and arr[steps] < arr[steps + 1]: steps += 1 ...
class Solution: def valid_mountain_array(self, arr: List[int]) -> bool: if len(arr) < 3: return False steps = 0 while steps + 1 < len(arr) and arr[steps] < arr[steps + 1]: steps += 1 if steps == 0 or steps == len(arr) - 1: return False whi...
def run(proj_path, target_name, params): return { "project_name": "Sample", "build_types": ["Debug", "Release"], "archs": [ { "arch": "x86_64", "conan_arch": "x86_64", "conan_profile": "ezored_windows_app_profile", } ...
def run(proj_path, target_name, params): return {'project_name': 'Sample', 'build_types': ['Debug', 'Release'], 'archs': [{'arch': 'x86_64', 'conan_arch': 'x86_64', 'conan_profile': 'ezored_windows_app_profile'}]}
def feature_extraction(cfg,Z,N) : #function Descriptors=feature_extraction(Z,N) # #% The features are the magnitude of the Zernike moments. ...
def feature_extraction(cfg, Z, N): f = cfg.zeros(N + 1, N + 1) + cfg.NaN for n in cfg.rng(0, N): for l in cfg.rng(0, n): if cfg.mod(n - l, 2) == 0: aux_1 = Z[n, l, 0:l + 1] if l > 0: aux_2 = cfg.conj(aux_1[1:l + 1]) for ...
#!/usr/bin/env python3 ''' Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words ''' def palindrome_per...
""" Given a string, write a function to check if it is a permutation of a palindrome. A palindrome is a word or phrase that is the same forwards and backwards. A permutation is a rearrangement of letters. The palindrome does not need to be limited to just dictionary words """ def palindrome_permutation(string): if...
# ../../../../goal/translate.py --gcrootfinder=asmgcc --gc=semispace src8 class A: pass def foo(rec, a1, a2, a3, a4, a5, a6): if rec > 0: b = A() foo(rec-1, b, b, b, b, b, b) foo(rec-1, b, b, b, b, b, b) foo(rec-1, a6, a5, a4, a3, a2, a1) # __________ Entry point __________ ...
class A: pass def foo(rec, a1, a2, a3, a4, a5, a6): if rec > 0: b = a() foo(rec - 1, b, b, b, b, b, b) foo(rec - 1, b, b, b, b, b, b) foo(rec - 1, a6, a5, a4, a3, a2, a1) def entry_point(argv): foo(5, a(), a(), a(), a(), a(), a()) return 0 def target(*args): return...
# by Kami Bigdely # Split temporary variable patty = 70 # [gr] pickle = 20 # [gr] tomatoes = 25 # [gr] lettuce = 15 # [gr] buns = 95 # [gr] kimchi = 30 # [gr] mayo = 5 # [gr] golden_fried_onion = 20 # [gr] ny_burger_weight = (2 * patty + 4 * pickle + 3 * tomatoes + 2 * lettuce + 2 * buns) ...
patty = 70 pickle = 20 tomatoes = 25 lettuce = 15 buns = 95 kimchi = 30 mayo = 5 golden_fried_onion = 20 ny_burger_weight = 2 * patty + 4 * pickle + 3 * tomatoes + 2 * lettuce + 2 * buns kimchi_burger_weight = 2 * patty + 4 * pickle + 3 * tomatoes + kimchi + mayo + golden_fried_onion + 2 * buns if __name__ == '__main__...
def get_nonempty_wallets_number_query(): pipeline = [ {'$match': {'balance': {'$gt': 0}} }, {'$group': { '_id': 'null', 'count': {'$sum': 1} } }, {'$project': { '_id': 0, 'count': 1 } } ] return ...
def get_nonempty_wallets_number_query(): pipeline = [{'$match': {'balance': {'$gt': 0}}}, {'$group': {'_id': 'null', 'count': {'$sum': 1}}}, {'$project': {'_id': 0, 'count': 1}}] return pipeline def get_highest_block_number_in_db_query(): pipeline = [{'$sort': {'height': -1}}, {'$limit': 1}, {'$project': {...
class ship: name = "Unknown" maelstrom_location_data = None quadrant = '' sector = '' def __init__(self, name = "Unknown", maelstrom_location_data = None): self.name = name self.maelstrom_location_data = maelstrom_location_data def getMaelstromLocationData(self): retu...
class Ship: name = 'Unknown' maelstrom_location_data = None quadrant = '' sector = '' def __init__(self, name='Unknown', maelstrom_location_data=None): self.name = name self.maelstrom_location_data = maelstrom_location_data def get_maelstrom_location_data(self): return ...
def read_data(): with open ('input.txt') as f: data = f.readlines() return [d.strip() for d in data] def write_data(data): with open('output.txt','w') as f: for d in data: f.write(str(d)+'\n') ### class Instruction(object): """docstring for Instruction""" def __init__(self, text): super(Instruction, se...
def read_data(): with open('input.txt') as f: data = f.readlines() return [d.strip() for d in data] def write_data(data): with open('output.txt', 'w') as f: for d in data: f.write(str(d) + '\n') class Instruction(object): """docstring for Instruction""" def __init__(se...
def pow(x,y): if y==0: return 1 else: temp = pow(x,int(y/2)) mult = x if y>0 else 1/x if y%2==1: return mult * temp * temp else: return temp * temp if __name__ == "__main__": x = 2 y = 5 res = pow(x,y) print(res) x = 3 y =...
def pow(x, y): if y == 0: return 1 else: temp = pow(x, int(y / 2)) mult = x if y > 0 else 1 / x if y % 2 == 1: return mult * temp * temp else: return temp * temp if __name__ == '__main__': x = 2 y = 5 res = pow(x, y) print(res) ...
def terminate(): """Terminate this script. If defined, the module's 'stop' function will be called. If this module is debugging, the debugger is stopped. The script's module and any modules imported relative to this module are removed from sys.modules and released.""" pass def autoTerminate(value): ...
def terminate(): """Terminate this script. If defined, the module's 'stop' function will be called. If this module is debugging, the debugger is stopped. The script's module and any modules imported relative to this module are removed from sys.modules and released.""" pass def auto_terminate(value): """...
class Person: def say_hi(self): print('Hello, how are you?') vinit = Person() # object created vinit.say_hi() # object calls class method.
class Person: def say_hi(self): print('Hello, how are you?') vinit = person() vinit.say_hi()
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
"""Internal information about the projector plugin.""" plugin_name = 'projector' plugins_dir = 'plugins' plugin_assets_name = 'org_tensorflow_tensorboard_projector' projector_filename = 'projector_config.pbtxt'
"""Module applying the nonlocal scattering matrix method. This method is theoretically described in ... Here it is applied to the calculation of reflectance and transmittance of planar heterostructures. """ __version__ = "0.1.0"
"""Module applying the nonlocal scattering matrix method. This method is theoretically described in ... Here it is applied to the calculation of reflectance and transmittance of planar heterostructures. """ __version__ = '0.1.0'
# Implementation of the queue data structure. # A list is used to store queue elements, where the tail # of the queue is element 0, and the head is # the last element class Queue: ''' Constructor. Initializes the list items ''' def __init__(self): self.items = [] ''' Returns true...
class Queue: """ Constructor. Initializes the list items """ def __init__(self): self.items = [] '\n Returns true if queue is empty, false otherwise\n ' def is_empty(self): return self.items == [] '\n Enqueue: Add item to end (tail) of the queue\n ' def en...
filename = 'programing.txt' with open(filename, 'a') as f: f.write('I also like data science\n') f.write('I\'m James Noria.\n') #add new things
filename = 'programing.txt' with open(filename, 'a') as f: f.write('I also like data science\n') f.write("I'm James Noria.\n")
# generated from genmsg/cmake/pkg-genmsg.context.in messages_str = "" services_str = "/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_gamma_300-1500_operation_and_simulation/dynamixel_motor-master/dynamixel_controllers/srv/RestartController.srv;/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_...
messages_str = '' services_str = '/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_gamma_300-1500_operation_and_simulation/dynamixel_motor-master/dynamixel_controllers/srv/RestartController.srv;/home/gabriel/Cyton_ROS/Cyton-Gamma-1500/catkin_ws/src/cyton_gamma_300-1500_operation_and_simulation/dynamixel_mot...
#-- THIS LINE SHOULD BE THE FIRST LINE OF YOUR SUBMISSION! --# def is_divisible_by(n, numbers): if not numbers or 0 in numbers: raise ValueError for num in numbers: if n % num != 0: return False return True #-- THIS LINE SHOULD BE THE LAST LINE OF YOUR SUBMISSION! ---# #...
def is_divisible_by(n, numbers): if not numbers or 0 in numbers: raise ValueError for num in numbers: if n % num != 0: return False return True assert is_divisible_by(30, [3, 6, 15]) assert not is_divisible_by(30, [3, 6, 29]) try: is_divisible_by(30, [0, 6, 29]) assert Fa...
registry_repositories = [ { "registry_name": "resoto-do-plugin-test", "name": "hw", "tag_count": 1, "manifest_count": 1, "latest_manifest": { "digest": "sha256:2ce85c6b306674dcab6eae5fda252037d58f78b0e1bbd41aabf95de6cd7e4a9e", "registry_name": "resoto-...
registry_repositories = [{'registry_name': 'resoto-do-plugin-test', 'name': 'hw', 'tag_count': 1, 'manifest_count': 1, 'latest_manifest': {'digest': 'sha256:2ce85c6b306674dcab6eae5fda252037d58f78b0e1bbd41aabf95de6cd7e4a9e', 'registry_name': 'resoto-do-plugin-test', 'repository': 'hw', 'compressed_size_bytes': 5164, 'si...
# encoding: utf-8 # module System.Diagnostics.CodeAnalysis calls itself CodeAnalysis # from mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089,System,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089 # by generator 1.145 """ NamespaceTracker represent a CLS namespace. """ # no i...
""" NamespaceTracker represent a CLS namespace. """ class Excludefromcodecoverageattribute(Attribute, _Attribute): """ Specifies that the attributed code should be excluded from code coverage information. ExcludeFromCodeCoverageAttribute() """ def __init__(self, *args): """ x.__init__(...) init...
def OnEditApart(s1, s2): if abs(len(s1) - len(s2)) > 1: return False if s1 in s2 or s2 in s1: return True mismatch = 0 for i in range(len(s1)): if s1[i]!=s2[i]: mismatch+=1 if mismatch > 1: return False return True
def on_edit_apart(s1, s2): if abs(len(s1) - len(s2)) > 1: return False if s1 in s2 or s2 in s1: return True mismatch = 0 for i in range(len(s1)): if s1[i] != s2[i]: mismatch += 1 if mismatch > 1: return False return True
S = list(map(str, input())) if '7' in S: print('Yes') else: print('No')
s = list(map(str, input())) if '7' in S: print('Yes') else: print('No')
# python3 class JobQueue: def read_data(self): self.num_workers, m = map(int, input().split()) self.array = [[0]*2 for i in range(self.num_workers)] self.jobs = list(map(int, input().split())) assert m == len(self.jobs) self.workers = [None] * len(self.jobs) self.sta...
class Jobqueue: def read_data(self): (self.num_workers, m) = map(int, input().split()) self.array = [[0] * 2 for i in range(self.num_workers)] self.jobs = list(map(int, input().split())) assert m == len(self.jobs) self.workers = [None] * len(self.jobs) self.start = [...
# https://leetcode.com/problems/queue-reconstruction-by-height class Solution: def reconstructQueue(self, people: List[List[int]]) -> List[List[int]]: people.sort(key=lambda x: (-x[0], x[1])) output = [] for p in people: output.insert(p[1], p) return output
class Solution: def reconstruct_queue(self, people: List[List[int]]) -> List[List[int]]: people.sort(key=lambda x: (-x[0], x[1])) output = [] for p in people: output.insert(p[1], p) return output
# Have the function KaprekarsConstant(num) take the num parameter being passed which will be a 4-digit number with at least two distinct digits. Your program should perform the following routine on the number: Arrange the digits in descending order and in ascending order (adding zeroes to fit it to a 4-digit number), a...
def kaprekars_constant(str): return str
try: f = open("textfile", "r") f.write("write a TEST LINE ") except TypeError: print("There was a type error") except OSError: print("Hey you have an OS error") except: print("All other exception") finally: print("I always run")
try: f = open('textfile', 'r') f.write('write a TEST LINE ') except TypeError: print('There was a type error') except OSError: print('Hey you have an OS error') except: print('All other exception') finally: print('I always run')
def selectionSort(alist): for slot in range(len(alist) - 1, 0, -1): iMax = 0 for index in range(1, slot + 1): if alist[index] > alist[iMax]: iMax = index alist[slot], alist[iMax] = alist[iMax], alist[slot]
def selection_sort(alist): for slot in range(len(alist) - 1, 0, -1): i_max = 0 for index in range(1, slot + 1): if alist[index] > alist[iMax]: i_max = index (alist[slot], alist[iMax]) = (alist[iMax], alist[slot])
src = Glob('*.c') component = aos_component('libid2', src) component.add_global_includes('include') component.add_comp_deps('security/plat_gen', 'security/libkm') component.add_global_macros('CONFIG_AOS_SUPPORT=1') component.add_prebuilt_libs('lib/' + component.get_arch() + '/libid2.a')
src = glob('*.c') component = aos_component('libid2', src) component.add_global_includes('include') component.add_comp_deps('security/plat_gen', 'security/libkm') component.add_global_macros('CONFIG_AOS_SUPPORT=1') component.add_prebuilt_libs('lib/' + component.get_arch() + '/libid2.a')
my_list = [1, 2, 3, 4, 5] def sqr(x): return x ** 2; def map(list_, f): return [f(x) for x in list_] def map_iter(list_, f): new_list = [] for i in list_: new_list.append(f(i)) return new_list
my_list = [1, 2, 3, 4, 5] def sqr(x): return x ** 2 def map(list_, f): return [f(x) for x in list_] def map_iter(list_, f): new_list = [] for i in list_: new_list.append(f(i)) return new_list
def twoStrings(s1, s2): """Compares two strings to find matching substring.""" for i in s1: if i in s2: return "YES" return "NO" def twoStrings(s1, s2): """Compares two strings to find matching substring using set.""" a = set(s1) if len(s1 >= s2) else set(s2) for i in s1: ...
def two_strings(s1, s2): """Compares two strings to find matching substring.""" for i in s1: if i in s2: return 'YES' return 'NO' def two_strings(s1, s2): """Compares two strings to find matching substring using set.""" a = set(s1) if len(s1 >= s2) else set(s2) for i in s1: ...
# https://www.codewars.com/kata/returning-strings/train/python # My solution def greet(name): return "Hello, %s how are you doing today?" % name # ... def greet(name): return f'Hello, {name} how are you doing today?' # ... def greet(name): return "Hello, {} how are you doing today?".format(name) ...
def greet(name): return 'Hello, %s how are you doing today?' % name def greet(name): return f'Hello, {name} how are you doing today?' def greet(name): return 'Hello, {} how are you doing today?'.format(name)
def envelopeHiBounds(valueList, wnd): return envelopeBounds(valueList, wnd, 0.025) def envelopeLoBounds(valueList, wnd): return envelopeBounds(valueList, wnd, 0.025) def envelopeBounds(valueList, wnd, ratio): return valueList.ewm(wnd).mean() * (1 + ratio)
def envelope_hi_bounds(valueList, wnd): return envelope_bounds(valueList, wnd, 0.025) def envelope_lo_bounds(valueList, wnd): return envelope_bounds(valueList, wnd, 0.025) def envelope_bounds(valueList, wnd, ratio): return valueList.ewm(wnd).mean() * (1 + ratio)
# test lists assert 3 in [1, 2, 3] assert 3 not in [1, 2] assert not (3 in [1, 2]) assert not (3 not in [1, 2, 3]) # test strings assert "foo" in "foobar" assert "whatever" not in "foobar" # test bytes # TODO: uncomment this when bytes are implemented # assert b"foo" in b"foobar" # assert b"whatever" not in b"foobar...
assert 3 in [1, 2, 3] assert 3 not in [1, 2] assert not 3 in [1, 2] assert not 3 not in [1, 2, 3] assert 'foo' in 'foobar' assert 'whatever' not in 'foobar' assert b'1' < b'2' assert b'1' <= b'2' assert b'5' <= b'5' assert b'4' > b'2' assert not b'1' >= b'2' assert b'10' >= b'10' try: bytes() > 2 except TypeError: ...
# coding=utf-8 __author__ = 'mlaptev' if __name__ == "__main__": matrix = [] line = input() while line != 'end': matrix.append([int(i) for i in line.split()]) line = input() for i in range(len(matrix)): for j in range(len(matrix[i])): print(matrix[i-1][j] + matrix[(i...
__author__ = 'mlaptev' if __name__ == '__main__': matrix = [] line = input() while line != 'end': matrix.append([int(i) for i in line.split()]) line = input() for i in range(len(matrix)): for j in range(len(matrix[i])): print(matrix[i - 1][j] + matrix[(i + 1) % len(ma...
""" Error module holds all custom errors for the scraper class """ class InvalidWebsite(Exception): """ An Invalid website was proided to the scraper """ pass
""" Error module holds all custom errors for the scraper class """ class Invalidwebsite(Exception): """ An Invalid website was proided to the scraper """ pass
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library") def _internal_closure_fragment_export_impl(ctx): ctx.actions.write( output = ctx.outputs.out, content = """ goog.require('%s'); goog.exportSymbol('_', %s); """ % (ctx.attr.module, ctx.attr.function), ) ...
load('@io_bazel_rules_closure//closure:defs.bzl', 'closure_js_binary', 'closure_js_library') def _internal_closure_fragment_export_impl(ctx): ctx.actions.write(output=ctx.outputs.out, content="\ngoog.require('%s');\ngoog.exportSymbol('_', %s);\n" % (ctx.attr.module, ctx.attr.function)) _internal_closure_fragment_e...
"""Rio-Cogeo Errors and Warnings.""" class DeprecationWarning(UserWarning): """Rio-cogeo module deprecations warning.""" class LossyCompression(UserWarning): """Rio-cogeo module Lossy compression warning.""" class IncompatibleBlockRasterSize(UserWarning): """Rio-cogeo module incompatible raster block/...
"""Rio-Cogeo Errors and Warnings.""" class Deprecationwarning(UserWarning): """Rio-cogeo module deprecations warning.""" class Lossycompression(UserWarning): """Rio-cogeo module Lossy compression warning.""" class Incompatibleblockrastersize(UserWarning): """Rio-cogeo module incompatible raster block/siz...