content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
def company_list(): company = dict() command = input() while command != 'End': current = command.split(' -> ') company_name = current[0] employee_id = current[1] if company_name not in company: company[company_name] = [] if employee_id not in company...
def company_list(): company = dict() command = input() while command != 'End': current = command.split(' -> ') company_name = current[0] employee_id = current[1] if company_name not in company: company[company_name] = [] if employee_id not in company[c...
__description__ = "Librato Silverline process monitoring and management" __config__ = { "librato.api_token": dict( description = "API token for account", default = "0", ), "librato.server_id_cmd": dict( description = "Command to run to generate server ID", default = None, ...
__description__ = 'Librato Silverline process monitoring and management' __config__ = {'librato.api_token': dict(description='API token for account', default='0'), 'librato.server_id_cmd': dict(description='Command to run to generate server ID', default=None), 'librato.template_id': dict(description='Template ID for th...
def gcd(x: int, y: int) -> int: while y: x, y = y, x % y return x def solve(n: int) -> None: """Solve project euler problem 91 with x, y <= n.""" count_triangles = 3 * n * n for x in range(1, n+1): for y in range(1, x+1): xy_gcd = gcd(x, y) move_x, move_y = x...
def gcd(x: int, y: int) -> int: while y: (x, y) = (y, x % y) return x def solve(n: int) -> None: """Solve project euler problem 91 with x, y <= n.""" count_triangles = 3 * n * n for x in range(1, n + 1): for y in range(1, x + 1): xy_gcd = gcd(x, y) (move_x, m...
def format_time(time): """ Formats the given time into HH:MM:SS. """ hours, remainder = divmod(time / 1000, 3600) minutes, seconds = divmod(remainder, 60) return '%02d:%02d:%02d' % (hours, minutes, seconds)
def format_time(time): """ Formats the given time into HH:MM:SS. """ (hours, remainder) = divmod(time / 1000, 3600) (minutes, seconds) = divmod(remainder, 60) return '%02d:%02d:%02d' % (hours, minutes, seconds)
class Node: def __init__(self, id, raw_id=None): self.id = id self.raw_id = raw_id self.children = [] self.parent = None def get_level(self): return self.id.split('_')[0] def add_child(self, node): self.children.append(node) def is_raw(self): re...
class Node: def __init__(self, id, raw_id=None): self.id = id self.raw_id = raw_id self.children = [] self.parent = None def get_level(self): return self.id.split('_')[0] def add_child(self, node): self.children.append(node) def is_raw(self): r...
# -*- coding: utf-8 -*- """ error code define :create: 2018/9/23 :copyright: smileboywtu """ ERRORS = { "success": { "code": 0, "message": "api request ok" }, "params_err": { "code": 1001, "message": "client params error" }, "internal_err": { "code": 1...
""" error code define :create: 2018/9/23 :copyright: smileboywtu """ errors = {'success': {'code': 0, 'message': 'api request ok'}, 'params_err': {'code': 1001, 'message': 'client params error'}, 'internal_err': {'code': 1002, 'message': 'server internal error'}}
MAPPER = { 'head': [ 'okulista', 'neurolog', 'chirurg' ], 'limb': [ 'chirurg', 'dermatolog', 'fizjoterapeuta' ], 'chest': [ 'pulmonolog', 'kardiolog', ], 'back': [ 'fizjoterapeuta', ], 'eye': [ 'okulista'...
mapper = {'head': ['okulista', 'neurolog', 'chirurg'], 'limb': ['chirurg', 'dermatolog', 'fizjoterapeuta'], 'chest': ['pulmonolog', 'kardiolog'], 'back': ['fizjoterapeuta'], 'eye': ['okulista']}
#Gestor de Visitas #Programa Principal pacientes = {} listatempnome = list() listatempidade = list() while True: listatempnome.append(input('Nome: ')) listatempidade.append(input('Idade: ')) pacientes['nome'] = listatempnome[:] pacientes['idade'] = listatempidade[:] listatempidade.clear l...
pacientes = {} listatempnome = list() listatempidade = list() while True: listatempnome.append(input('Nome: ')) listatempidade.append(input('Idade: ')) pacientes['nome'] = listatempnome[:] pacientes['idade'] = listatempidade[:] listatempidade.clear listatempnome.clear sair = int(input('999: ...
def secant(a, b, E, n): k = 0 while k < n: t_x = ((a * f(b)) - (b * f(a))) \ / (f(b) - f(a)) if abs(b-a) < E or abs(f(b)) < E: print ("Raiz = {}".format(t_x)) break a = b b = t_x k += 1 f = lambda x: x**3 - 3*x -1 Er...
def secant(a, b, E, n): k = 0 while k < n: t_x = (a * f(b) - b * f(a)) / (f(b) - f(a)) if abs(b - a) < E or abs(f(b)) < E: print('Raiz = {}'.format(t_x)) break a = b b = t_x k += 1 f = lambda x: x ** 3 - 3 * x - 1 err = 0.01 secant(0, 1, Err, 20)
# -*- coding: utf-8 -*- def heating_requirement_table_9c ( temperature_reduction_when_heating_is_off_1_weekday_living_room, temperature_reduction_when_heating_is_off_2_weekday_living_room, temperature_reduction_when_heating_is_off_1_weekend_living_room, temperature_reduction_when_heati...
def heating_requirement_table_9c(temperature_reduction_when_heating_is_off_1_weekday_living_room, temperature_reduction_when_heating_is_off_2_weekday_living_room, temperature_reduction_when_heating_is_off_1_weekend_living_room, temperature_reduction_when_heating_is_off_2_weekend_living_room, temperature_reduction_when_...
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for number in numbers: print(number) print() for number in numbers: print(number**2)
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] for number in numbers: print(number) print() for number in numbers: print(number ** 2)
# # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # # SPDX-License-Identifier: Apache-2.0 # SOC_IRAM_LOW = 0x40020000 SOC_IRAM_HIGH = 0x40070000 SOC_DRAM_LOW = 0x3ffb0000 SOC_DRAM_HIGH = 0x40000000 SOC_RTC_DRAM_LOW = 0x3ff9e000 SOC_RTC_DRAM_HIGH = 0x3ffa0000 SOC_RTC_DATA_LOW = 0x50000000 SOC_RTC_DAT...
soc_iram_low = 1073872896 soc_iram_high = 1074200576 soc_dram_low = 1073414144 soc_dram_high = 1073741824 soc_rtc_dram_low = 1073340416 soc_rtc_dram_high = 1073348608 soc_rtc_data_low = 1342177280 soc_rtc_data_high = 1342185472
def omp_sections_private(): sum = 7 sum0 = 0 if 'omp parallel': if 'omp sections private(sum0)': if 'omp section': sum0 = 0 for i in range(0, 400): sum0 += i if 'omp critical': sum += sum0 ...
def omp_sections_private(): sum = 7 sum0 = 0 if 'omp parallel': if 'omp sections private(sum0)': if 'omp section': sum0 = 0 for i in range(0, 400): sum0 += i if 'omp critical': sum += sum0 ...
ELIGIBILITY_TRANSACTION_CODE = '270' SUPPORTED_TRANSACTION_CODES = [ELIGIBILITY_TRANSACTION_CODE] class UnsupportedTransactionException(Exception): """ Indicates that a X12 Transaction Type is not currently supported """ pass class InvalidControlSegment(Exception): """ Raised when a X12 mess...
eligibility_transaction_code = '270' supported_transaction_codes = [ELIGIBILITY_TRANSACTION_CODE] class Unsupportedtransactionexception(Exception): """ Indicates that a X12 Transaction Type is not currently supported """ pass class Invalidcontrolsegment(Exception): """ Raised when a X12 messag...
class Section: def __init__(self, name): self.name = name self.tasks = [] def add_task(self, new_task): if new_task in self.tasks: return f"Task is already in the section {self.name}" self.tasks.append(new_task) return f"Task {new_task.details()} is added to...
class Section: def __init__(self, name): self.name = name self.tasks = [] def add_task(self, new_task): if new_task in self.tasks: return f'Task is already in the section {self.name}' self.tasks.append(new_task) return f'Task {new_task.details()} is added to...
class Tokenizer: def __init__(self, exp): self.tokens = self._parse_exp(exp); self.index = 0; def _parse_exp(self,exp): list = []; for el in exp: if el.isspace(): continue; list.append(el); return list; def get_next_token(sel...
class Tokenizer: def __init__(self, exp): self.tokens = self._parse_exp(exp) self.index = 0 def _parse_exp(self, exp): list = [] for el in exp: if el.isspace(): continue list.append(el) return list def get_next_token(self): ...
heights = [45, 34, 37, 30, 44, 50] for height in heights: if height < 31: print(f'{height} is too short to ride')
heights = [45, 34, 37, 30, 44, 50] for height in heights: if height < 31: print(f'{height} is too short to ride')
{ 'variables': { 'chromium_code': 1, 'chrome_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', 'app_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/app', 'webkit_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/webkit', # TODO(sgk): eliminate this; see comment in build/common.gypi 'msvs_debug_link_inc...
{'variables': {'chromium_code': 1, 'chrome_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/chrome', 'app_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/app', 'webkit_grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/webkit', 'msvs_debug_link_incremental': '1'}, 'includes': ['../../../build/common.gypi'], 'target_defaults': {'type': 'l...
#!/usr/bin/env python #coding=utf-8 class EmptyError(Exception): pass
class Emptyerror(Exception): pass
''' Fibonacci series: 1 1 2 3 5 8 13 ... Write a function to spit out the nth Fibonacci number input: 5 output: 5 ''' def fib(limit): a, b = 0, 1 for i in range(limit): a, b = b, a+b return a print(fib(10))
""" Fibonacci series: 1 1 2 3 5 8 13 ... Write a function to spit out the nth Fibonacci number input: 5 output: 5 """ def fib(limit): (a, b) = (0, 1) for i in range(limit): (a, b) = (b, a + b) return a print(fib(10))
input = """ % Strategic Companies % % As we want to produce X, Y or Z must be strategic. strategic(Y) v strategic(Z) :- produced_by(X,Y,Z). % W is strategic, if it is controlled by strategic % companies X, Y, and Z strategic(W) :- controlled_by(W,X,Y,Z), Strategic(X), Strategic(Y), Strategic(Z...
input = '\n% Strategic Companies\n%\n% As we want to produce X, Y or Z must be strategic.\n\n strategic(Y) v strategic(Z) :- produced_by(X,Y,Z).\n\n% W is strategic, if it is controlled by strategic \n% companies X, Y, and Z \n\n strategic(W) :- controlled_by(W,X,Y,Z), \n Strategic(X), Strategic(Y), St...
# -*- coding: utf-8 -*- NOTES = [100, 50, 20, 10, 5, 2] COINS = [1, 0.50, 0.25, 0.10, 0.05, 0.01] def main(): money = float(input()) print('NOTAS:') for note in NOTES: number_of_notes = money // note print('%d nota(s) de R$ %.2f' % (number_of_notes, note)) money = money - (number_...
notes = [100, 50, 20, 10, 5, 2] coins = [1, 0.5, 0.25, 0.1, 0.05, 0.01] def main(): money = float(input()) print('NOTAS:') for note in NOTES: number_of_notes = money // note print('%d nota(s) de R$ %.2f' % (number_of_notes, note)) money = money - number_of_notes * note print('MO...
def helloWorld(yourName): print('Hello World'+ yourName) helloWorld('Hackerobert')
def hello_world(yourName): print('Hello World' + yourName) hello_world('Hackerobert')
class StorageNotFound(Exception): pass class StorageSettedError(Exception): pass class MismatchedVersionError(Exception): pass class InvalidPassword(Exception): pass
class Storagenotfound(Exception): pass class Storagesettederror(Exception): pass class Mismatchedversionerror(Exception): pass class Invalidpassword(Exception): pass
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here t = int(input()) for _ in range(t): n =...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ t = int(input()) for _ in range(t): n = int(input()) a = ma...
def quickSort(array): """ sort array by dividing and conquering inplace""" quickSortSplitter(array, 0, len(array)-1) return array def quickSortSplitter(array, start, end): """ splits the array into subarrays""" if start < end: split_point = partition(array, start, end) quickS...
def quick_sort(array): """ sort array by dividing and conquering inplace""" quick_sort_splitter(array, 0, len(array) - 1) return array def quick_sort_splitter(array, start, end): """ splits the array into subarrays""" if start < end: split_point = partition(array, start, end) qu...
def kw_only_arg(*, kwo): return kwo def many_kw_only_args(*, first, second, third): return first + second + third def kw_only_arg_with_default(*, kwo='default', another='another'): return '{}-{}'.format(kwo, another) def mandatory_after_defaults(*, default1='xxx', mandatory, default2='zzz'): retur...
def kw_only_arg(*, kwo): return kwo def many_kw_only_args(*, first, second, third): return first + second + third def kw_only_arg_with_default(*, kwo='default', another='another'): return '{}-{}'.format(kwo, another) def mandatory_after_defaults(*, default1='xxx', mandatory, default2='zzz'): return '...
''' n=2 m=3 print(n/m) print(n/m + 1) print('n/m + 1 =' , n/m + 1) #print('n/m + 1 =' , n/m + 1, sep=' ' ) print('n/m + 1 =' ,'\n' , n/m + 1) print('n/m + 1 =' , n/m + 1, sep='\n' ) print('n/m + 1 =' , n/m + 1, 125, sep='\n') ''' #how to format my output x = 2 y = 3 result = x/y ''' print('result =', result) # for...
""" n=2 m=3 print(n/m) print(n/m + 1) print('n/m + 1 =' , n/m + 1) #print('n/m + 1 =' , n/m + 1, sep=' ' ) print('n/m + 1 =' ,' ' , n/m + 1) print('n/m + 1 =' , n/m + 1, sep=' ' ) print('n/m + 1 =' , n/m + 1, 125, sep=' ') """ x = 2 y = 3 result = x / y "\nprint('result =', result)\n# format using string format ope...
""" String 1) Cover with " " or ' ' or """ """ or ''' ''' 2) Include ' or " with "'" or '"' or \' or \" 3) Change line with \n or ''' ''' or """ """ String Operation 1) Concatenate : str + str 2) Multiply : str * times 3) Get length : len(str) 4) Indexing : str[num] ...
""" String 1) Cover with " " or ' ' or or ''' ''' 2) Include ' or " with "'" or '"' or ' or " 3) Change line with or ''' ''' or String Operation 1) Concatenate : str + str 2) Multiply : str * times 3) Get length : len(str) 4) Indexing : str[num] str[-num]...
def add_prefix_un(word): return "un" + word def make_word_groups(vocab_words): return(" :: " + vocab_words[0]).join(vocab_words) def remove_suffix_ness(word): base = word[:-4] if base[-1] == 'i': return base[:-1] + 'y' return base def noun_to_verb(sentenc...
def add_prefix_un(word): return 'un' + word def make_word_groups(vocab_words): return (' :: ' + vocab_words[0]).join(vocab_words) def remove_suffix_ness(word): base = word[:-4] if base[-1] == 'i': return base[:-1] + 'y' return base def noun_to_verb(sentence, index): return sentence.sp...
"""test misordered except """ __revision__ = 1 try: __revision__ += 1 except Exception: __revision__ = 0 except TypeError: __revision__ = 0 try: __revision__ += 1 except LookupError: __revision__ = 0 except IndexError: __revision__ = 0 try: __revision__ += 1 except (LookupError, NameErro...
"""test misordered except """ __revision__ = 1 try: __revision__ += 1 except Exception: __revision__ = 0 except TypeError: __revision__ = 0 try: __revision__ += 1 except LookupError: __revision__ = 0 except IndexError: __revision__ = 0 try: __revision__ += 1 except (LookupError, NameError): ...
def create_all(db): db.Model.metadata.create_all(bind=db.engine) def expose_psycopg2_connection(connection): connection_proxy = connection.connection psycopg2_connection = connection_proxy.connection return psycopg2_connection class create_connection: def __init__(self, db, raw=False): ...
def create_all(db): db.Model.metadata.create_all(bind=db.engine) def expose_psycopg2_connection(connection): connection_proxy = connection.connection psycopg2_connection = connection_proxy.connection return psycopg2_connection class Create_Connection: def __init__(self, db, raw=False): se...
def roundrobin(*iterables): "roundrobin('ABC', 'D', 'EF') --> A D E B F C" # Recipe credited to George Sakkis num_active = len(iterables) nexts = cycle(iter(it).__next__ for it in iterables) while num_active: try: for next in nexts: yield next() except Sto...
def roundrobin(*iterables): """roundrobin('ABC', 'D', 'EF') --> A D E B F C""" num_active = len(iterables) nexts = cycle((iter(it).__next__ for it in iterables)) while num_active: try: for next in nexts: yield next() except StopIteration: num_activ...
def palin_perm(str): bitvec = [0] * 26 str = str.lower() for char in str: charCode = ord(char) - ord("a") if charCode >= 0 and charCode < 26: if bitvec[charCode] == 0: bitvec[charCode] = 1 else: bitvec[charCode] = 0 one = False ...
def palin_perm(str): bitvec = [0] * 26 str = str.lower() for char in str: char_code = ord(char) - ord('a') if charCode >= 0 and charCode < 26: if bitvec[charCode] == 0: bitvec[charCode] = 1 else: bitvec[charCode] = 0 one = False ...
################################################################################ # Define package composition ################################################################################ __all__ = ["root", "test", "message", "administration", "kb", "classifier", "note"] # ZX: There's a better way to do this; see ...
__all__ = ['root', 'test', 'message', 'administration', 'kb', 'classifier', 'note']
class RhinoDeselectAllObjectsEventArgs(EventArgs): # no doc Document=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get: Document(self: RhinoDeselectAllObjectsEventArgs) -> RhinoDoc """ ObjectCount=property(lambda self: object(),lambda self,v: None,lambda self: None) """Get:...
class Rhinodeselectallobjectseventargs(EventArgs): document = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Get: Document(self: RhinoDeselectAllObjectsEventArgs) -> RhinoDoc\n\n\n\n' object_count = property(lambda self: object(), lambda self, v: None, lambda self: None) 'Get:...
"""Top-level package for airmailer.""" __author__ = """Christopher Malek""" __email__ = 'cmalek@caltech.edu' __version__ = '0.1.2'
"""Top-level package for airmailer.""" __author__ = 'Christopher Malek' __email__ = 'cmalek@caltech.edu' __version__ = '0.1.2'
def progress(count: float, total: float): bar_len = 60 filled_len = int(round(bar_len * count / float(total))) percents = round(100.0 * count / float(total), 1) bar = '=' * filled_len + '-' * (bar_len - filled_len) print(f'\r[{bar}] {percents}%', end='')
def progress(count: float, total: float): bar_len = 60 filled_len = int(round(bar_len * count / float(total))) percents = round(100.0 * count / float(total), 1) bar = '=' * filled_len + '-' * (bar_len - filled_len) print(f'\r[{bar}] {percents}%', end='')
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' ~Gros ''' config = { "host": "localhost", "task1": { "port_alice": 10001, "port_bob": 10002 }, "task2": { "port_alice": 10001, "port_bob": 10002 }, "task3": { "port_alice": 30001, "port_bob": 300...
""" ~Gros """ config = {'host': 'localhost', 'task1': {'port_alice': 10001, 'port_bob': 10002}, 'task2': {'port_alice': 10001, 'port_bob': 10002}, 'task3': {'port_alice': 30001, 'port_bob': 30002}, 'task4': {'port_bob': 40001}}
# Copyright 2017 Google LLC. 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 applicable law or a...
def compile_grm(name, src=None, out=None, data=[], _compiler='@org_opengrm_thrax//:compiler'): """Compile a Thrax grm file to a FAR file. Note that if src depends on other this target needs to include *both* the compile_grm target for it and the .grm file. """ suffix = '.grm' if not name: ...
class TestCRUD: def test_add_one(self, db): result = db.add_one( {'name': 'alice', 'url': 'alice.com', 'method': 'get'}) errors = result.get('errors') success = result.get('success') assert errors is None assert success is True def test_fetch_one(self, db, ...
class Testcrud: def test_add_one(self, db): result = db.add_one({'name': 'alice', 'url': 'alice.com', 'method': 'get'}) errors = result.get('errors') success = result.get('success') assert errors is None assert success is True def test_fetch_one(self, db, db_dummy_data)...
CONFIG={ 'ppi_n': { 'aggr': 'concat', 'arch': '1-0-1-0', 'dataset': 'ppi', 'dropout': 0, 'edge_budget': 4000, 'length': 2, 'log_dir': 'none', 'lr': 0.01, 'n_epochs': 50, 'n_hidden': 512, 'no_batch_norm': False, 'node_budget': 6000, 'num_subg': 50, 'num_roots': 3000, 'sampler': 'node', '...
config = {'ppi_n': {'aggr': 'concat', 'arch': '1-0-1-0', 'dataset': 'ppi', 'dropout': 0, 'edge_budget': 4000, 'length': 2, 'log_dir': 'none', 'lr': 0.01, 'n_epochs': 50, 'n_hidden': 512, 'no_batch_norm': False, 'node_budget': 6000, 'num_subg': 50, 'num_roots': 3000, 'sampler': 'node', 'use_val': True, 'val_every': 1, '...
def stableMarriage(m, w): m_id = sorted(w[0]) w_id = sorted(m[0]) m_num = 0 rank = 0 m_parner = [] wait = len(m) tem_m_num = m_num tem_rank = rank tem_m_parner = [] for i in range(len(m)): m_parner.append(-1) while (wait): if (m[m_num][rank] not in m_parner): m_parner[m_num] = m[m_...
def stable_marriage(m, w): m_id = sorted(w[0]) w_id = sorted(m[0]) m_num = 0 rank = 0 m_parner = [] wait = len(m) tem_m_num = m_num tem_rank = rank tem_m_parner = [] for i in range(len(m)): m_parner.append(-1) while wait: if m[m_num][rank] not in m_parner: ...
def get_temp(): temp_c = float(input("Enter temp in Celsius: ")) return temp_c def convert_to_fahr(c): return c * 9 / 5 + 32 def display_results(c, f): print(f"{c:.2f} C = {f:.2f} F") def main(): temp_c = get_temp() temp_f = convert_to_fahr(temp_c) display_results(temp_c, temp_f) main()
def get_temp(): temp_c = float(input('Enter temp in Celsius: ')) return temp_c def convert_to_fahr(c): return c * 9 / 5 + 32 def display_results(c, f): print(f'{c:.2f} C = {f:.2f} F') def main(): temp_c = get_temp() temp_f = convert_to_fahr(temp_c) display_results(temp_c, temp_f) main()
while not done: env.render() step_counter += 1 action = agent.get_action(obs) next_obs, reward, done, _ = env.step(action) agent.store_env(obs, reward, next_obs, action, done) obs = next_obs if step_counter % train_freq == 0: agent.learn(i + 1) agent.target_network.load_state_dic...
while not done: env.render() step_counter += 1 action = agent.get_action(obs) (next_obs, reward, done, _) = env.step(action) agent.store_env(obs, reward, next_obs, action, done) obs = next_obs if step_counter % train_freq == 0: agent.learn(i + 1) agent.target_network.load_sta...
#!/usr/bin/env python __version__ = '0.0.1' __author__ = 'Fernandes Macedo' __email__ = 'masedos@gmail.com' print(''' ******************************************************************************* | | | | _________|________________.=""_;=.___________...
__version__ = '0.0.1' __author__ = 'Fernandes Macedo' __email__ = 'masedos@gmail.com' print('\n*******************************************************************************\n | | | |\n _________|________________.=""_;=.______________|____________________...
""" This files contains some simple functions to be used in the main, there is no garbled circuit logic here. """ ALICE_DATA_PATH = 'input/alice.txt' BOB_DATA_PATH = 'input/bob.txt' def read_input(path): """ It reads a file content :param path: the path of the file to read. :return: It returns the fi...
""" This files contains some simple functions to be used in the main, there is no garbled circuit logic here. """ alice_data_path = 'input/alice.txt' bob_data_path = 'input/bob.txt' def read_input(path): """ It reads a file content :param path: the path of the file to read. :return: It returns the file...
class Carro: def __init__(self, motor, direcao): self.motor = motor self.direcao = direcao def calcular_velocidade(self): return self.motor.velocidade def acelerar(self): self.motor.acelerar() def frear(self): self.motor.frear() def calcula...
class Carro: def __init__(self, motor, direcao): self.motor = motor self.direcao = direcao def calcular_velocidade(self): return self.motor.velocidade def acelerar(self): self.motor.acelerar() def frear(self): self.motor.frear() def calcular_direcao(self)...
# (C) Copyright 2019-2021 Hewlett Packard Enterprise Development LP. # Apache License 2.0 class LoginError(Exception): """Exception raised for errors during login. Attributes: message -- explanation of the error """ def __init__(self, message, status_code=None): self.message = message...
class Loginerror(Exception): """Exception raised for errors during login. Attributes: message -- explanation of the error """ def __init__(self, message, status_code=None): self.message = message self.status_code = status_code
def is_multichannel(samples): """ :param samples: :return: """ return len(samples.shape) > 2
def is_multichannel(samples): """ :param samples: :return: """ return len(samples.shape) > 2
def sumTotal(): ''' Objective : To find the sum of list User inputs : A list in which elements are space separated Output : Sum of the list ''' ''' approach : convert the user entered list to a integer list and loop through the list adding each element to sum variable. ''' ...
def sum_total(): """ Objective : To find the sum of list User inputs : A list in which elements are space separated Output : Sum of the list """ '\n approach : convert the user entered list to a integer list and loop through the list adding each element to sum variable.\n ' i...
def Try_Glossary(Item,Glossary,Header): if Item in Glossary.keys(): return Header.append(Glossary[Item]) else: print(Item) return Header def NFL_Shorthand_to_Headers(stats_type,Col_Cats,Col_Names): Stats_Type = stats_type.upper() Repeats = [] Header = [] ...
def try__glossary(Item, Glossary, Header): if Item in Glossary.keys(): return Header.append(Glossary[Item]) else: print(Item) return Header def nfl__shorthand_to__headers(stats_type, Col_Cats, Col_Names): stats__type = stats_type.upper() repeats = [] header = [] for inde...
class Solution(object): def maxTurbulenceSize(self, arr): """ :type arr: List[int] :rtype: int """ result = 1 start = 0 high = True for i in range(1, len(arr)): if arr[i-1] == arr[i]: start = i elif high ^ (arr...
class Solution(object): def max_turbulence_size(self, arr): """ :type arr: List[int] :rtype: int """ result = 1 start = 0 high = True for i in range(1, len(arr)): if arr[i - 1] == arr[i]: start = i elif high ^ (...
__version__ = "3.10.0" # Version number of the Ansible collection we want to use __edb_ansible_version__ = "3.10.0" def to_num(version): """ Convert version number from 3 digits tuple to 1 integer. (1, 2, 3) -> 100020003 """ v = '' for n in version: v += '{0:04d}'.format(int(n)) ret...
__version__ = '3.10.0' __edb_ansible_version__ = '3.10.0' def to_num(version): """ Convert version number from 3 digits tuple to 1 integer. (1, 2, 3) -> 100020003 """ v = '' for n in version: v += '{0:04d}'.format(int(n)) return int(v) def to_str(version): """ Convert versi...
# NORMAL BINARY TREE DELETE OPERATION AND INSERTION U SING LEVEL ORDER TRAVERSAL. class Node: def __init__(self, data): self.data = data self.left = None self.right = None # Inorder traversal of a binary tree def inorder(temp): if (not temp): return inorder(temp.left) pr...
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def inorder(temp): if not temp: return inorder(temp.left) print(temp.data, end=' ') inorder(temp.right) def level_order(root): q = [] if root == None: return N...
class Solution: def canConvert(self, s1: str, s2: str) -> bool: if s1 == s2: return True dp = {} for i, j in zip(s1, s2): if dp.setdefault(i, j) != j: return False return len(set(s2)) < 26
class Solution: def can_convert(self, s1: str, s2: str) -> bool: if s1 == s2: return True dp = {} for (i, j) in zip(s1, s2): if dp.setdefault(i, j) != j: return False return len(set(s2)) < 26
def train_model(x_train, x_test, y_train, y_test): input_shape=(img_rows,img_cols,3) model=create_model(input_shape,total_countries) adams=optimizers.Adam(lr=1e-4) model.compile(loss='categorical_crossentropy', optimizer= adams, metrics=['accuracy']) model.fit(x = x_t...
def train_model(x_train, x_test, y_train, y_test): input_shape = (img_rows, img_cols, 3) model = create_model(input_shape, total_countries) adams = optimizers.Adam(lr=0.0001) model.compile(loss='categorical_crossentropy', optimizer=adams, metrics=['accuracy']) model.fit(x=x_train, y=y_train, epochs=...
def get_bytewise_xor(text: bytes, key: int) -> bytes: return bytes([byte ^ key for byte in text]) def get_character_frequency(ciphertext: bytes): # Referenced from https://en.wikipedia.org/wiki/Letter_frequency character_frequencies = { 'a': .08167, 'b': .01492, 'c': .02782, 'd': .04253...
def get_bytewise_xor(text: bytes, key: int) -> bytes: return bytes([byte ^ key for byte in text]) def get_character_frequency(ciphertext: bytes): character_frequencies = {'a': 0.08167, 'b': 0.01492, 'c': 0.02782, 'd': 0.04253, 'e': 0.12702, 'f': 0.02228, 'g': 0.02015, 'h': 0.06094, 'i': 0.06094, 'j': 0.00153, ...
class LazySegTree: X_unit = 0 A_unit = 0 @classmethod def X_f(cls, x, y): return max(x, y) @classmethod def A_f(cls, x, y): return x + y @classmethod def operate(cls, x, a): return x + a def __init__(self, N): self.N = N self.X = [self.X_un...
class Lazysegtree: x_unit = 0 a_unit = 0 @classmethod def x_f(cls, x, y): return max(x, y) @classmethod def a_f(cls, x, y): return x + y @classmethod def operate(cls, x, a): return x + a def __init__(self, N): self.N = N self.X = [self.X_un...
""" ============================================================================ Implementation Exercise: Singly Linked List ============================================================================ ------- Phase 1: ------- 1. Node and LinkedList initialization 2. Getting a node by its position 3. Adding a node to ...
""" ============================================================================ Implementation Exercise: Singly Linked List ============================================================================ ------- Phase 1: ------- 1. Node and LinkedList initialization 2. Getting a node by its position 3. Adding a node to ...
DEBUG = True HOST = '0.0.0.0' PORT = 8000 SECRET_KEY = 'bunchofrandomfancylettersandstuff123094u-39u2' DEFAULT_RATE = '2/hour' GET_RATE = '10/hour'
debug = True host = '0.0.0.0' port = 8000 secret_key = 'bunchofrandomfancylettersandstuff123094u-39u2' default_rate = '2/hour' get_rate = '10/hour'
def _check_inputs(self, **kwargs): # function used to check whether the required inputs have been specified if 'sampling' not in kwargs: raise AttributeError("sampling strategy not specified") elif kwargs['sampling'] not in ['RNDM', 'EVEN']: raise ValueError(f"{kwargs['sampling']} is not a...
def _check_inputs(self, **kwargs): if 'sampling' not in kwargs: raise attribute_error('sampling strategy not specified') elif kwargs['sampling'] not in ['RNDM', 'EVEN']: raise value_error(f"{kwargs['sampling']} is not a valid sampling label.") else: self.sampling = kwargs['sampling']...
# Jeff Heaton's Kaggle Utilities # Copyright 2019 by Jeff Heaton, Open Source, Released under the Apache License # For more information: https://github.com/jeffheaton/jh-kaggle-util # # This file just holds all of the constant values used to configure other parts of the program. FIT_TYPE_REGRESSION = "reg" FIT_TYPE_...
fit_type_regression = 'reg' fit_type_binary_classification = 'bclass' fit_type_classification = 'class' eval_r2 = 'r2' eval_logloss = 'logloss' eval_auc = 'auc'
s = input() n = int(input()) for i in range(n): word = input() if len(word) >= 4 and s[0] in word: flag = True for ch in word: if ch not in s: flag = False break if flag: print(word)
s = input() n = int(input()) for i in range(n): word = input() if len(word) >= 4 and s[0] in word: flag = True for ch in word: if ch not in s: flag = False break if flag: print(word)
# Calculo o enesimo termo def calcula_termo(primeiro_termo, razao, posicao_termo): return primeiro_termo * pow(razao, (posicao_termo - 1)) # Verifica se a serie converge def verifica_convergencia(razao): if abs(razao) < 1: return True else: return False # Calcula a soma infinita def soma_i...
def calcula_termo(primeiro_termo, razao, posicao_termo): return primeiro_termo * pow(razao, posicao_termo - 1) def verifica_convergencia(razao): if abs(razao) < 1: return True else: return False def soma_infinita(primeiro_termo, razao): return primeiro_termo / (1 - razao) def soma_par...
# Binary Tree Zigzag Level Order Traversal class Solution(object): def zigzagLevelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: return [] level = [root] reverse = False visited = [] # each lev...
class Solution(object): def zigzag_level_order(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: return [] level = [root] reverse = False visited = [] while level: if reverse: ...
# -*- coding: utf-8 -*- """Top-level package for pyagetool.""" __author__ = """Marco Bellaccini""" __version__ = '0.1.0'
"""Top-level package for pyagetool.""" __author__ = 'Marco Bellaccini' __version__ = '0.1.0'
# data used to calculate inflation # source: https://www.minneapolisfed.org/community/financial-and-economic-education/cpi-calculator-information/consumer-price-index-and-inflation-rates-1913 data = { 1913:9.9, 1915:10.1, 1916:10.9, 1917:12.8, 1918:15.0, 1919:17.3, 1920:20.0, 1921:17.9, 1922:16.8,...
data = {1913: 9.9, 1915: 10.1, 1916: 10.9, 1917: 12.8, 1918: 15.0, 1919: 17.3, 1920: 20.0, 1921: 17.9, 1922: 16.8, 1923: 17.1, 1924: 17.1, 1925: 17.5, 1926: 17.7, 1927: 17.4, 1928: 17.2, 1929: 17.2, 1930: 16.7, 1931: 15.2, 1932: 13.6, 1933: 12.9, 1934: 13.4, 1935: 13.7, 1936: 13.9, 1937: 14.4, 1938: 14.1, 1939: 13.9, 1...
def val(X): if X<0: return 1 else: return 2
def val(X): if X < 0: return 1 else: return 2
class TexTextError(RuntimeError): """ Basic class of all TexText errors""" pass class TexTextNonFatalError(TexTextError): """ TexText can continue execution properly """ pass class TexTextCommandError(TexTextNonFatalError): pass class TexTextCommandNotFound(TexTextCommandError): pass cl...
class Textexterror(RuntimeError): """ Basic class of all TexText errors""" pass class Textextnonfatalerror(TexTextError): """ TexText can continue execution properly """ pass class Textextcommanderror(TexTextNonFatalError): pass class Textextcommandnotfound(TexTextCommandError): pass class T...
class BananoConversions(): # 1 BANANO = 10e29 RAW RAW_PER_BAN = 10 ** 29 @classmethod def raw_to_banano(self, raw_amt): return raw_amt / self.RAW_PER_BAN @staticmethod def banano_to_raw(ban_amt): expanded = float(ban_amt) * 100 return int(expanded) * (10 ** 27)
class Bananoconversions: raw_per_ban = 10 ** 29 @classmethod def raw_to_banano(self, raw_amt): return raw_amt / self.RAW_PER_BAN @staticmethod def banano_to_raw(ban_amt): expanded = float(ban_amt) * 100 return int(expanded) * 10 ** 27
n=int(input()) k=int(input()) sum=0 for i in range(n): x=int(input()) if i<k: sum+=x print(sum)
n = int(input()) k = int(input()) sum = 0 for i in range(n): x = int(input()) if i < k: sum += x print(sum)
class CrunchyrollError(Exception): pass class LoginError(CrunchyrollError): pass
class Crunchyrollerror(Exception): pass class Loginerror(CrunchyrollError): pass
# -*- coding: utf-8 -*- ''' File name: code\step_numbers\sol_178.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #178 :: Step Numbers # # For more information see: # https://projecteuler.net/problem=178 # Problem Statement ''' Consider ...
""" File name: code\\step_numbers\\sol_178.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nConsider the number 45656. \nIt can be seen that each pair of consecutive digits of 45656 has a difference of one.\nA number for which every pair of consecutive digits has a differenc...
if_list=['if','fi'] for_list=['for','fro','ofr','orf','rof','rfo'] elif_list=['elif', 'elfi', 'eilf', 'eifl', 'efil', 'efli', 'leif', 'lefi', 'lief', 'life', 'lfie', 'lfei', 'ilef', 'ilfe', 'ielf', 'iefl', 'ifel', 'ifle', 'flie', 'flei', 'file', 'fiel', 'feil', 'feli'] else_list=['else', 'eles', 'esle', 'esel', 'ees...
if_list = ['if', 'fi'] for_list = ['for', 'fro', 'ofr', 'orf', 'rof', 'rfo'] elif_list = ['elif', 'elfi', 'eilf', 'eifl', 'efil', 'efli', 'leif', 'lefi', 'lief', 'life', 'lfie', 'lfei', 'ilef', 'ilfe', 'ielf', 'iefl', 'ifel', 'ifle', 'flie', 'flei', 'file', 'fiel', 'feil', 'feli'] else_list = ['else', 'eles', 'esle', '...
"""FamilySearch Utilities submodule""" # Python imports # Magic class Utilities: """https://familysearch.org/developers/docs/api/resources#utilities""" def __init__(self): """https://familysearch.org/developers/docs/api/examples#utilities""" pass def pending_modifications(self)...
"""FamilySearch Utilities submodule""" class Utilities: """https://familysearch.org/developers/docs/api/resources#utilities""" def __init__(self): """https://familysearch.org/developers/docs/api/examples#utilities""" pass def pending_modifications(self): """https://familysearch.or...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def buildTree(self, inorder: List[int], postorder: List[int]) -> TreeNode: # inorderMap = {...
class Solution: def build_tree(self, inorder: List[int], postorder: List[int]) -> TreeNode: if not inorder: return None root_val = postorder.pop() root_idx = inorder.index(root_val) root = tree_node(root_val) root.right = self.buildTree(inorder[root_idx + 1:], po...
# Do the python implementation here ! def kolmogorov(histo1, histo2): stat, p_value = 0,0 # TODO return (stat, p_value) def wasserstein(F1, F2, nbr_pixels, p): total_area = 0 delta_D = 0 cosine_d = 0 quadratic_d = 0 for i in range(nbr_pixels): if abs(F1[i] - F2[i]) > delta_D:...
def kolmogorov(histo1, histo2): (stat, p_value) = (0, 0) return (stat, p_value) def wasserstein(F1, F2, nbr_pixels, p): total_area = 0 delta_d = 0 cosine_d = 0 quadratic_d = 0 for i in range(nbr_pixels): if abs(F1[i] - F2[i]) > delta_D: delta_d = abs(F1[i] - F2[i]) ...
GIT_SSH_KEY = "/etc/opt/topology/github" TOPOLOGY_DATA_DIR = "/data/webhook/topology" CONTACT_DATA_DIR = "/data/webhook/contact" WEBHOOK_STATE_DIR = "/data/webhook/state" WEBHOOK_DATA_DIR = "/data/webhook/topology.git" WEBHOOK_DATA_REPO = "https://github.com/opensciencegrid/topology" WEBHOOK_DATA_BRANCH =...
git_ssh_key = '/etc/opt/topology/github' topology_data_dir = '/data/webhook/topology' contact_data_dir = '/data/webhook/contact' webhook_state_dir = '/data/webhook/state' webhook_data_dir = '/data/webhook/topology.git' webhook_data_repo = 'https://github.com/opensciencegrid/topology' webhook_data_branch = 'master' webh...
#!/usr/bin/env python # Copyright Contributors to the Open Shading Language project. # SPDX-License-Identifier: BSD-3-Clause # https://github.com/imageworks/OpenShadingLanguage # Set up a texture that is a gradient image with a distinct alpha gradient # of 0.5 from left to right and 0.25 right to left, and no change ...
command += oiiotool('-pattern fill:topleft=0.125,0.25,0.5,0:topright=0.125,0.25,0.5,0.5:bottomleft=0.125,0.25,0.5,0.25:bottomright=0.125,0.25,0.5,0.75 64x64 4 -d half -o alpharamp.exr') command += testshade('-g 64 64 --center -od uint8 -o Cout out.tif test') outputs = ['out.txt', 'out.tif']
""" Another numerical technique for constructing a hash function is called the mid-square method. We first square the item, and then extract some portion of the resulting digits. For example, if the item were 44, we would first compute 44**2=1,936. By extracting the middle two digits, 93, and performing the remainder ...
""" Another numerical technique for constructing a hash function is called the mid-square method. We first square the item, and then extract some portion of the resulting digits. For example, if the item were 44, we would first compute 44**2=1,936. By extracting the middle two digits, 93, and performing the remainder ...
def rotate(text, key): def encode_single(char, key): if char.isupper(): return chr((ord(char) - 65 + key) % 26 + 65) elif char.islower(): return chr((ord(char) - 97 + key) % 26 + 97) else: return char return ''.join(map(lambda c: encode_single(c, key)...
def rotate(text, key): def encode_single(char, key): if char.isupper(): return chr((ord(char) - 65 + key) % 26 + 65) elif char.islower(): return chr((ord(char) - 97 + key) % 26 + 97) else: return char return ''.join(map(lambda c: encode_single(c, key)...
class NoBoxHasPositiveArea(Exception): def __init__(self): Exception.__init__(self, 'No box has positive area.') class NoBoxToKeep(Exception): def __init__(self): Exception.__init__(self, 'No box to keep in detection.')
class Noboxhaspositivearea(Exception): def __init__(self): Exception.__init__(self, 'No box has positive area.') class Noboxtokeep(Exception): def __init__(self): Exception.__init__(self, 'No box to keep in detection.')
class Node: def __init__(self, value, next_value=None): self.value = value self.next = next_value def getvalue(self): return self.value def getnext(self): return self.next def setnext(self,data): self.next = data def setvalue(self,data): sel...
class Node: def __init__(self, value, next_value=None): self.value = value self.next = next_value def getvalue(self): return self.value def getnext(self): return self.next def setnext(self, data): self.next = data def setvalue(self, data): self.va...
class dotGetClipPlanes_t(object): # no doc aPlaneIDs=None aUpX=None aUpY=None aUpZ=None aX=None aY=None aZ=None nPlanes=None
class Dotgetclipplanes_T(object): a_plane_i_ds = None a_up_x = None a_up_y = None a_up_z = None a_x = None a_y = None a_z = None n_planes = None
def test_list_users(test_client): response = test_client.user.list() assert response
def test_list_users(test_client): response = test_client.user.list() assert response
# This file is actually used to mock a module for the tests. class Dinosaur: def __init__(self): self.name = "trex" @staticmethod def a(value): return value @classmethod def b(cls, value): return value def hello(self): return self.name def roar(): """ ...
class Dinosaur: def __init__(self): self.name = 'trex' @staticmethod def a(value): return value @classmethod def b(cls, value): return value def hello(self): return self.name def roar(): """ Does a roar! """ return 'Roarr!!' def super_roar():...
n=int(input()) if n<=125: print(4) elif n<=211: print(6) else: print(8)
n = int(input()) if n <= 125: print(4) elif n <= 211: print(6) else: print(8)
T1 = [[1, 2], [3, 4]] T2 = [[2, 3, 5], [7, 11, 13], [17, 19, 23]] T3 = [[2, 5, 2, 5], [2, 5, 5, 2], [2, 5, 2, 2], [2, 5, 5, 5]] T4 = [[43, 74, 53, 97], [80, 61, 61, 19], [61, 73, 89, 93], [42, 17, 89, 80]] TESTS = [T1, T2, T3, T4] def isok(T): N = len(T) for r in range(1, N): for c in range(r): ...
t1 = [[1, 2], [3, 4]] t2 = [[2, 3, 5], [7, 11, 13], [17, 19, 23]] t3 = [[2, 5, 2, 5], [2, 5, 5, 2], [2, 5, 2, 2], [2, 5, 5, 5]] t4 = [[43, 74, 53, 97], [80, 61, 61, 19], [61, 73, 89, 93], [42, 17, 89, 80]] tests = [T1, T2, T3, T4] def isok(T): n = len(T) for r in range(1, N): for c in range(r): ...
{('B', 'a'): {('E', 'a'): 0.9949479593949608, ('M', 'a'): 0.005052040605039197}, ('B', 'ad'): {('E', 'ad'): 0.9992523782106919, ('M', 'ad'): 0.0007476217893081491}, ('B', 'ag'): {}, ('B', 'an'): {('E', 'an'): 1.0}, ('B', 'b'): {('E', 'b'): 0.934691101357768, ('M', 'b'): 0.06530889864223...
{('B', 'a'): {('E', 'a'): 0.9949479593949608, ('M', 'a'): 0.005052040605039197}, ('B', 'ad'): {('E', 'ad'): 0.9992523782106919, ('M', 'ad'): 0.0007476217893081491}, ('B', 'ag'): {}, ('B', 'an'): {('E', 'an'): 1.0}, ('B', 'b'): {('E', 'b'): 0.934691101357768, ('M', 'b'): 0.06530889864223198}, ('B', 'bg'): {}, ('B', 'c')...
__version__ = '1.5.3' __copyright__ = 'Copyright (c) 2009-2017, Kyle Fuller, Mariusz Felisiak' __licence__ = 'BSD' __author__ = [ 'Kyle Fuller <kyle@fuller.li>', 'Jannis Leidel (jezdez)', 'krisje8 <krisje8@gmail.com>', 'Mariusz Felisiak <felisiak.mariusz@gmail.com>', ] __URL__ = 'https://django-request....
__version__ = '1.5.3' __copyright__ = 'Copyright (c) 2009-2017, Kyle Fuller, Mariusz Felisiak' __licence__ = 'BSD' __author__ = ['Kyle Fuller <kyle@fuller.li>', 'Jannis Leidel (jezdez)', 'krisje8 <krisje8@gmail.com>', 'Mariusz Felisiak <felisiak.mariusz@gmail.com>'] __url__ = 'https://django-request.readthedocs.org/en/...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2021, Cisco Systems # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r""" --- module: virtual_account_sync short_description: Manage VirtualAccountSync objects of DeviceOnboardingPnp description: - >...
documentation = "\n---\nmodule: virtual_account_sync\nshort_description: Manage VirtualAccountSync objects of DeviceOnboardingPnp\ndescription:\n- >\n Synchronizes the device info from the given smart account & virtual account with the PnP database. The response\n payload returns a list of synced devices.\n- Return...
n = int(input()) l = sorted(map(int, input().split())) ans = 10000 for i in range(n - 1): if l[i + 1] - l[i] < ans: ans = l[i + 1] - l[i] print(ans)
n = int(input()) l = sorted(map(int, input().split())) ans = 10000 for i in range(n - 1): if l[i + 1] - l[i] < ans: ans = l[i + 1] - l[i] print(ans)
# recursive function that replaces nodes with deeper one until no bypass is required # the inputs are two set, the one of elements to bypass, the working one def BypassedSet(Database, SetToBypass, WorkingSet): for i in WorkingSet.intersection(SetToBypass): # this pass consists into removing all bypass elem...
def bypassed_set(Database, SetToBypass, WorkingSet): for i in WorkingSet.intersection(SetToBypass): WorkingSet.remove(i) linked_set = Database.LinkedToElements(i) WorkingSet.update(LinkedSet) if WorkingSet.intersection(SetToBypass): new_set = bypassed_set(Database, SetToBypass, W...
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") _proto_library_suffix = "proto" _go_proto_library_suffix = "go_proto" WELL_KNOWN_TYPE_PACKAGES = { "any": ("github.com/golang/protobuf/ptypes/any", []), "api": ("google.golang.org/genproto/protobuf/api", ["source_context", "type"]), "compiler_p...
load('@io_bazel_rules_go//proto:def.bzl', 'go_proto_library') _proto_library_suffix = 'proto' _go_proto_library_suffix = 'go_proto' well_known_type_packages = {'any': ('github.com/golang/protobuf/ptypes/any', []), 'api': ('google.golang.org/genproto/protobuf/api', ['source_context', 'type']), 'compiler_plugin': ('githu...
# Puzzle Input with open('Day15_Input.txt') as puzzle_input: starting = puzzle_input.read().split('\n') # Separate the integers (convert from CSV to python list) for index, number_list in enumerate(starting): starting[index] = number_list.split(',') # Parameters starting = list(map(int, starting[0])) # Allow...
with open('Day15_Input.txt') as puzzle_input: starting = puzzle_input.read().split('\n') for (index, number_list) in enumerate(starting): starting[index] = number_list.split(',') starting = list(map(int, starting[0])) len_starting = len(starting) memory = dict() for last_turn in range(1, len_starting): memo...
#!/usr/bin/env python3 print(len('Albert Einstein')) print('Albert' + ' Einstein') x = 'Albert' y = ' ' z = 'Einstein' print(x + y + z) print('Albert' + y + z) print('Four score and ' + str(7) + ' years ago') print(4 * '-') x = '-' print(4 * x) print('one\ntwo\nthree') print('one\ttwo\nthree\tfour') print('one','t...
print(len('Albert Einstein')) print('Albert' + ' Einstein') x = 'Albert' y = ' ' z = 'Einstein' print(x + y + z) print('Albert' + y + z) print('Four score and ' + str(7) + ' years ago') print(4 * '-') x = '-' print(4 * x) print('one\ntwo\nthree') print('one\ttwo\nthree\tfour') print('one', 'two', 'three', sep='.. ') pr...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ PyRfid Copyright (C) 2015 Philipp Meisberger <team@pm-codeworks.de> All rights reserved. @author: Philipp Meisberger <team@pm-codeworks.de> """ __version__ = '1.2'
""" PyRfid Copyright (C) 2015 Philipp Meisberger <team@pm-codeworks.de> All rights reserved. @author: Philipp Meisberger <team@pm-codeworks.de> """ __version__ = '1.2'
# define the 'EXPECTED_BAKE_TIME' constant EXPECTED_BAKE_TIME = 40 # consider defining the 'PREPARATION_TIME' constant # equal to the time it takes to prepare a single layer PREPARATION_TIME = 2 # define the 'bake_time_remaining()' function def bake_time_remaining(elapsed_bake_time): """Calculate the bake t...
expected_bake_time = 40 preparation_time = 2 def bake_time_remaining(elapsed_bake_time): """Calculate the bake time remaining. :param elapsed_bake_time: int baking time already elapsed. :return: int remaining bake time derived from 'EXPECTED_BAKE_TIME'. Function that takes the actual minutes the lasa...
class Solution(object): def fullJustify(self, words, maxWidth): """ :type words: List[str] :type maxWidth: int :rtype: List[str] """ res = [] tmp = [] wordlen = 0 for word in words: if wordlen + len(word) + len(tmp) > maxWidth: if len(tmp) == 1: res.append(t...
class Solution(object): def full_justify(self, words, maxWidth): """ :type words: List[str] :type maxWidth: int :rtype: List[str] """ res = [] tmp = [] wordlen = 0 for word in words: if wordlen + len(word) + len(tmp) > maxWidth: if...