content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
start_time = [int(time) for time in input().split(":")] end_time = [int(time) for time in input().split(":")] h1, m1 = start_time[0], start_time[1] h2, m2 = end_time[0], end_time[1] h1_in_minutes = h1*60 h2_in_minutes = h2*60 half_time_in_minutes = (h2_in_minutes + m2) - (h1_in_minutes + m1) half_time = (h1_in_minut...
start_time = [int(time) for time in input().split(':')] end_time = [int(time) for time in input().split(':')] (h1, m1) = (start_time[0], start_time[1]) (h2, m2) = (end_time[0], end_time[1]) h1_in_minutes = h1 * 60 h2_in_minutes = h2 * 60 half_time_in_minutes = h2_in_minutes + m2 - (h1_in_minutes + m1) half_time = h1_in...
circulatory = [ 'Pulse', 'CVP', 'MAP (mmHg)', 'A-line MAP ', 'A-line 2 MAP ', 'Cardiac Output', 'PAP (Mean)' ] ICU_monitors = [ # 'CVP', 'Cardiac Output', # 'MAP (mmHg)', 'SVO2 (%)', 'SVR (dyne*sec)/cm5', 'SVRI (dyne*sec)/cm5', 'PVRI (dyne*sec)/cm5', 'PVR (dy...
circulatory = ['Pulse', 'CVP', 'MAP (mmHg)', 'A-line MAP ', 'A-line 2 MAP ', 'Cardiac Output', 'PAP (Mean)'] icu_monitors = ['Cardiac Output', 'SVO2 (%)', 'SVR (dyne*sec)/cm5', 'SVRI (dyne*sec)/cm5', 'PVRI (dyne*sec)/cm5', 'PVR (dyne*sec)/cm5'] swan_monitors = ['SVO2 (%)', 'CCI', 'CCO', 'SQI', 'SVI'] flow_oxygenation =...
class Person: def __init__(self, fname, lname): self.fname = fname self.lname = lname def __str__(self): return "{} {}".format(self.fname, self.lname) class Student(Person): def __init__(self, s_id, fname, lname): super().__init__(fname, lname) self.s_id ...
class Person: def __init__(self, fname, lname): self.fname = fname self.lname = lname def __str__(self): return '{} {}'.format(self.fname, self.lname) class Student(Person): def __init__(self, s_id, fname, lname): super().__init__(fname, lname) self.s_id = s_id ...
# -*- coding: utf-8 -*- lista = ["Andres", "Julio", "Carlos"] for elemento in lista: print(elemento) print("\nIterando sobre un rango de datos") # La funcion range, genera una lista de 0 al ultimo elemento -1 for numero in range(11): print(numero)
lista = ['Andres', 'Julio', 'Carlos'] for elemento in lista: print(elemento) print('\nIterando sobre un rango de datos') for numero in range(11): print(numero)
# Python Program to multiply two numbers # Store input numbers num1 = input("Enter first number: ") num2 = input("Enter second number: ") # Multiply two numbers mul = float(num1) * float(num2) # Display the sum print("The multiplication of {0} and {1} is {2}".format(num1, num2, mul))
num1 = input('Enter first number: ') num2 = input('Enter second number: ') mul = float(num1) * float(num2) print('The multiplication of {0} and {1} is {2}'.format(num1, num2, mul))
print("Simple Comparator") #version alpha 0.2.1 print("This is a comparator which compares the two inputted numbers.") firstNum = int(input("\nEnter the first value: -> ")) secondNum = int(input("Enter the second value: -> ")) print("\nYou entered "+str(firstNum)+" as the first value, and the "+str(secondNum)+" as the ...
print('Simple Comparator') print('This is a comparator which compares the two inputted numbers.') first_num = int(input('\nEnter the first value: -> ')) second_num = int(input('Enter the second value: -> ')) print('\nYou entered ' + str(firstNum) + ' as the first value, and the ' + str(secondNum) + ' as the second valu...
data = ( ((-0.195090, 0.980785), (0.000000, 1.000000)), ((-0.382683, 0.923880), (-0.195090, 0.980785)), ((-0.555570, 0.831470), (-0.382683, 0.923880)), ((-0.707107, 0.707107), (-0.555570, 0.831470)), ((-0.831470, 0.555570), (-0.707107, 0.707107)), ((-0.923880, 0.382683), (-0.831470, 0.555570)), ((-0.980785, 0.195090), ...
data = (((-0.19509, 0.980785), (0.0, 1.0)), ((-0.382683, 0.92388), (-0.19509, 0.980785)), ((-0.55557, 0.83147), (-0.382683, 0.92388)), ((-0.707107, 0.707107), (-0.55557, 0.83147)), ((-0.83147, 0.55557), (-0.707107, 0.707107)), ((-0.92388, 0.382683), (-0.83147, 0.55557)), ((-0.980785, 0.19509), (-0.92388, 0.382683)), ((...
names = [ '3-(2-benzothiazolylthio)-1-propanesulfonic acid', 'octyl beta-d-glucopyranoside', 'dexamethasone', '3-{3,5-dimethyl-4-[3-(3-methyl-isoxazol-5-yl)-propoxy]-phenyl}-5-trifluoromethyl-[1,2,4]oxadiazole', 'myristic acid', 'estradiol', 'benzene', '2-hydroxyethyl disulfide', 'na...
names = ['3-(2-benzothiazolylthio)-1-propanesulfonic acid', 'octyl beta-d-glucopyranoside', 'dexamethasone', '3-{3,5-dimethyl-4-[3-(3-methyl-isoxazol-5-yl)-propoxy]-phenyl}-5-trifluoromethyl-[1,2,4]oxadiazole', 'myristic acid', 'estradiol', 'benzene', '2-hydroxyethyl disulfide', 'nadph dihydro-nicotinamide-adenine-dinu...
num_epochs = 5 batch_size = 8 learning_rate = 0.1 def getNumEpochs(): return num_epochs def getBatchSize(): return batch_size def getLearningRate(): return learning_rate
num_epochs = 5 batch_size = 8 learning_rate = 0.1 def get_num_epochs(): return num_epochs def get_batch_size(): return batch_size def get_learning_rate(): return learning_rate
def convert_to_celsius(fahrenheit: float) -> float: return (fahrenheit - 32.0) * 5.0 / 9.0 print(convert_to_celsius(80)) print(convert_to_celsius(78.8)) print(convert_to_celsius(10.4))
def convert_to_celsius(fahrenheit: float) -> float: return (fahrenheit - 32.0) * 5.0 / 9.0 print(convert_to_celsius(80)) print(convert_to_celsius(78.8)) print(convert_to_celsius(10.4))
# this is a configuration file included by SConstruct NAME = 'cbaos.elf' ARCH = 'unix' LIBC = 'glibc' APPLICATION = 'blinky'
name = 'cbaos.elf' arch = 'unix' libc = 'glibc' application = 'blinky'
class Vertex: def __init__(self, node): self.id = node self.adjacent = {} def __str__(self): return str(self.id) + ' adjacent: ' + str([x.id for x in self.adjacent]) def add_neighbor(self, neighbor, weight=0): self.adjacent[neighbor] = weight def get_connections(self):...
class Vertex: def __init__(self, node): self.id = node self.adjacent = {} def __str__(self): return str(self.id) + ' adjacent: ' + str([x.id for x in self.adjacent]) def add_neighbor(self, neighbor, weight=0): self.adjacent[neighbor] = weight def get_connections(self)...
class InferExecutor(): def __init__(self, exec_net, input_images_dict): self.exec_net = exec_net self.infer_requests = self.exec_net.requests self.current_inference = 0 self.input_images_dict = input_images_dict for i in range(len(self.infer_requests)): self.exec_...
class Inferexecutor: def __init__(self, exec_net, input_images_dict): self.exec_net = exec_net self.infer_requests = self.exec_net.requests self.current_inference = 0 self.input_images_dict = input_images_dict for i in range(len(self.infer_requests)): self.exec_n...
volume_name= 'Type.World App' format = 'UDBZ' #files = [os.path.join(os.environ['PWD'], 'dist/Type.World.app')] files = ['dist/Type.World.app'] symlinks = { 'Applications': '/Applications'} default_view = 'icon-view' window_rect = ((500, 500), (443, 434)) background = 'wxPython/build/Mac/dmgbackground_final.tiff' # Ic...
volume_name = 'Type.World App' format = 'UDBZ' files = ['dist/Type.World.app'] symlinks = {'Applications': '/Applications'} default_view = 'icon-view' window_rect = ((500, 500), (443, 434)) background = 'wxPython/build/Mac/dmgbackground_final.tiff' arrange_by = 'name' icon_size = 128
def fn_1(): pass class cl_1: def meth_1(self): pass
def fn_1(): pass class Cl_1: def meth_1(self): pass
class ModelNotRegisteredError(Exception): pass class FieldNotValidError(Exception): def __init__(self, field): self.field = field class ObjectNotFoundError(Exception): pass class DBNotInitializedError(Exception): pass
class Modelnotregisterederror(Exception): pass class Fieldnotvaliderror(Exception): def __init__(self, field): self.field = field class Objectnotfounderror(Exception): pass class Dbnotinitializederror(Exception): pass
__version__ = '0.0.1' __all__ = [ 'make_dataset', 'make_features', 'make_train_models', ]
__version__ = '0.0.1' __all__ = ['make_dataset', 'make_features', 'make_train_models']
description = 'SPODI setup' group = 'basic' includes = [ 'system', 'sampletable', 'detector', 'nguide', 'slits', 'filter', 'mono', 'reactor' ] # caress@spodictrl:/opt/caress>./dump_u1 bls # BLS: OMGS=(-360,360) TTHS=(-3.1,160) OMGM=(40,80) CHIM=(-3,3) XM=(-15,15) # YM=(-15,15) ZM=(0,220) SLITM_U=(-31,85) SLI...
description = 'SPODI setup' group = 'basic' includes = ['system', 'sampletable', 'detector', 'nguide', 'slits', 'filter', 'mono', 'reactor'] devices = dict(wav=device('nicos_mlz.spodi.devices.wavelength.Wavelength', description='The incoming wavelength', unit='AA', omgm='omgm', tthm='tthm', crystal='crystal', plane='55...
N = int(input().rstrip()) class Node: __slots__ = ["key", "depth"] def __init__(self, key): self.key = key self.depth = -1 def toString(self): return "" + str(self.key + 1) + " " + str(self.depth) def generate(n): result = [[0]*n for _ in range(n)] for _ in range(n...
n = int(input().rstrip()) class Node: __slots__ = ['key', 'depth'] def __init__(self, key): self.key = key self.depth = -1 def to_string(self): return '' + str(self.key + 1) + ' ' + str(self.depth) def generate(n): result = [[0] * n for _ in range(n)] for _ in range(n): ...
# program description # :: calculates result of number of iterations of pi # constants iterInc = 1 # input variables numIter = int(input("Enter Number Of Iterations: ")) # calculation outNumIter = numIter def pi_approx(num_iterations): frc_inc = 3.0 f_val = 1.0 for i in range(num_iterations): ...
iter_inc = 1 num_iter = int(input('Enter Number Of Iterations: ')) out_num_iter = numIter def pi_approx(num_iterations): frc_inc = 3.0 f_val = 1.0 for i in range(num_iterations): f_val = f_val - 1 / frc_inc * (-1) ** i frc_inc += 2 return 4 * f_val print('Pi Approximation Based On ' + s...
#################################### MERGE SORT ##################################### # Merge sort is better than the Bubble Sort and it uses the Divide and Conquer strategy # Merge sort divides the list in smaller lists work on them and then merges them # Merge sort have Time Complexity of O(n log n), which is logarit...
def merge_sort(list): if len(list) > 1: mid = len(list) // 2 left_array = list[:mid] right_array = list[mid:] merge_sort(leftArray) merge_sort(rightArray) i = 0 j = 0 k = 0 while i < len(leftArray) and j < len(rightArray): if leftAr...
file = open("test.txt", "w") file.write("You are about to be omnommed") file.write("OMNOM") file.write("Haha, you just got omnommed") file.close()
file = open('test.txt', 'w') file.write('You are about to be omnommed') file.write('OMNOM') file.write('Haha, you just got omnommed') file.close()
''' Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2...
""" Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2...
def get_adaptable_network(input_shape=x_source_train.shape[1:]): inputs = Input(shape=input_shape) x = Conv2D(32, 5, padding='same', activation='relu', name='conv2d_1')(inputs) x = MaxPool2D(pool_size=2, strides=2, name='max_pooling2d_1')(x) x = Conv2D(48, 5, padding='same', activation='relu', name='con...
def get_adaptable_network(input_shape=x_source_train.shape[1:]): inputs = input(shape=input_shape) x = conv2_d(32, 5, padding='same', activation='relu', name='conv2d_1')(inputs) x = max_pool2_d(pool_size=2, strides=2, name='max_pooling2d_1')(x) x = conv2_d(48, 5, padding='same', activation='relu', name=...
fil = [0,1,1,1,0,-1,-1,-1] col = [-1,-1,0,1,1,1,0,-1] class Game: def __init__(self): self.current_player = 0 self.decoded_state = [[[0 for _ in range(0,2)] for _ in range(0,3)] for _ in range(0,3)] self.current_depth = 0 #Prints a human-friendly representation of th...
fil = [0, 1, 1, 1, 0, -1, -1, -1] col = [-1, -1, 0, 1, 1, 1, 0, -1] class Game: def __init__(self): self.current_player = 0 self.decoded_state = [[[0 for _ in range(0, 2)] for _ in range(0, 3)] for _ in range(0, 3)] self.current_depth = 0 def print_board(self): print('Last mov...
n = int(input()) while n != 0: dic = {} ss = set() for i in range(0, n): line = input() ss.add(line) ans = ord(line[0]) for j in range(1, len(line)): ans ^= ord(line[j]) if ans in dic: dic[ans][0] += 1 if line not in dic[ans][1]: ...
n = int(input()) while n != 0: dic = {} ss = set() for i in range(0, n): line = input() ss.add(line) ans = ord(line[0]) for j in range(1, len(line)): ans ^= ord(line[j]) if ans in dic: dic[ans][0] += 1 if line not in dic[ans][1]: ...
linha = 1 coluna = 1 while (linha <= 10): while (coluna <= 10): print (linha * coluna, end = '\t') coluna = coluna + 1 linha = linha + 1 print () coluna = 1
linha = 1 coluna = 1 while linha <= 10: while coluna <= 10: print(linha * coluna, end='\t') coluna = coluna + 1 linha = linha + 1 print() coluna = 1
sales = int(input()) * 3 res = "" if sales < 21 : res = 'Loss' elif sales > 21 : res = "Profit" else: res = "Broke Even" print(res,end="")
sales = int(input()) * 3 res = '' if sales < 21: res = 'Loss' elif sales > 21: res = 'Profit' else: res = 'Broke Even' print(res, end='')
# # PySNMP MIB module ChrComPmOpticsOMS-SRC-Current-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ChrComPmOpticsOMS-SRC-Current-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:20:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ...
class Solution: def combinationSum4(self, nums: List[int], target: int) -> int: # dp[i] means the number of possible combination to get a target i # dp[i] = sum(dp[i-num]) for num in nums dp = [-1 for _ in range(target+1)] dp[0] = 1 def count_combinations(targ): i...
class Solution: def combination_sum4(self, nums: List[int], target: int) -> int: dp = [-1 for _ in range(target + 1)] dp[0] = 1 def count_combinations(targ): if targ < 0: return 0 if dp[targ] != -1: return dp[targ] dp[targ...
cell_size = 40 cell_number = 20 background_color = (175, 215, 70) fruit_color = (126, 166, 114)
cell_size = 40 cell_number = 20 background_color = (175, 215, 70) fruit_color = (126, 166, 114)
#%% class Employee: salary = 1000 def __init__(self, name, sex, nationality, gmail): self.name = name self.sex = sex self.nationality = nationality self.gmail = gmail @property def name(self): return self.__name @name.setter def name(self, name): ...
class Employee: salary = 1000 def __init__(self, name, sex, nationality, gmail): self.name = name self.sex = sex self.nationality = nationality self.gmail = gmail @property def name(self): return self.__name @name.setter def name(self, name): se...
time=int(input("what time is it")) long=int(input("how long do you want your alarm to be for?")) longmodulo=long%24 alarmt=time+longmodulo print("I will set off at", alarmt) #x=5100 % 1400 #y=x+1400 #print(y)
time = int(input('what time is it')) long = int(input('how long do you want your alarm to be for?')) longmodulo = long % 24 alarmt = time + longmodulo print('I will set off at', alarmt)
# Copyright (c) 2011 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This file was modified from Mark Seaborn's verifier for nacl: # https://github.com/mseaborn/x86-decoder NOT_FOUND = object() def Memoize(func): ...
not_found = object() def memoize(func): cache = {} def wrapper(*args): value = cache.get(args, NOT_FOUND) if value is NOT_FOUND: value = func(*args) cache[args] = value return value return Wrapper
# -*- coding: utf-8 -*- #pc=local_import('pc') def index(): return dict(obj=Snake())
def index(): return dict(obj=snake())
class AccessTokenExpired(Exception): pass class InvalidResponseError(Exception): pass class NeverBounceAPIError(Exception): def __init__(self, response, *args, **kwargs): json = response.json() self.errors = [] if 'error_description' in json: self.errors.append(json['...
class Accesstokenexpired(Exception): pass class Invalidresponseerror(Exception): pass class Neverbounceapierror(Exception): def __init__(self, response, *args, **kwargs): json = response.json() self.errors = [] if 'error_description' in json: self.errors.append(json['e...
DAY = 1 def frequency(changes): freq = 0 for change in changes: freq += int(change) return freq def firstduplicatefreq(changes): changes_list = [int(c) for c in changes] size = len(changes_list) freq = 0 index = 0 seen_freqs = set([freq]) while True: change = change...
day = 1 def frequency(changes): freq = 0 for change in changes: freq += int(change) return freq def firstduplicatefreq(changes): changes_list = [int(c) for c in changes] size = len(changes_list) freq = 0 index = 0 seen_freqs = set([freq]) while True: change = change...
Play = 'XF86AudioPlay' Next = 'XF86AudioNext' Prev = 'XF86AudioPrev' Pause = 'XF86AudioPause' # Not working, Use 'Play' instead Forward = 'XF86AudioForward' Mute = 'XF86AudioMute' VolumeDown = 'XF86AudioLowerVolume' VolumeUp = 'XF86AudioRaiseVolume' Rewind = 'XF86AudioRewind' Stop = 'XF86AudioStop' Record = 'XF86Au...
play = 'XF86AudioPlay' next = 'XF86AudioNext' prev = 'XF86AudioPrev' pause = 'XF86AudioPause' forward = 'XF86AudioForward' mute = 'XF86AudioMute' volume_down = 'XF86AudioLowerVolume' volume_up = 'XF86AudioRaiseVolume' rewind = 'XF86AudioRewind' stop = 'XF86AudioStop' record = 'XF86AudioRecord' mic_mute = 'XF86AudioMicM...
# -------------- # Code starts here class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio'] class_2=['Hilary Mason','Carla Gentry','Corinna Cortes'] new_class=class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class)...
class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio'] class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes'] new_class = class_1 + class_2 print(new_class) new_class.append('Peter Warden') print(new_class) new_class.remove('Carla Gentry') print(new_class) courses = {'Math': 65, 'English...
def findit(A): if len(A) <= 1: return 0 if len(A) == 2: if A[0] <= A[1]: return 0 else: return 1 # len(A) > 2 for i, w in enumerate(A): if w > A[i+1]: return i+1 if __name__ =='__main__': words = [ 'ptolemaic'...
def findit(A): if len(A) <= 1: return 0 if len(A) == 2: if A[0] <= A[1]: return 0 else: return 1 for (i, w) in enumerate(A): if w > A[i + 1]: return i + 1 if __name__ == '__main__': words = ['ptolemaic', 'retrograde', 'supplant', 'undul...
def transform(legacy_data): result = {} for key in legacy_data: for c in legacy_data[key]: result[c.lower()] = key return result
def transform(legacy_data): result = {} for key in legacy_data: for c in legacy_data[key]: result[c.lower()] = key return result
# Keep on Truckin' # # December 18, 2019 # By Robin Nash motels = [0, 990, 1010, 1970, 2030, 2940, 3060, 3930, 4060, 4970, 5030, 5990, 6010, 7000] dmin = int(input()) dmax = int(input()) for i in range(int(input())): motels.append(int(input())) motels.sort() #store in each dp cell how man...
motels = [0, 990, 1010, 1970, 2030, 2940, 3060, 3930, 4060, 4970, 5030, 5990, 6010, 7000] dmin = int(input()) dmax = int(input()) for i in range(int(input())): motels.append(int(input())) motels.sort() dp = [0 for i in range(len(motels))] dp[0] = 1 for i in range(1, len(motels)): for j in range(i - 1, -1, -1): ...
editor = None def getEditor (): return editor def setEditor ( inEditor ): global editor editor = inEditor
editor = None def get_editor(): return editor def set_editor(inEditor): global editor editor = inEditor
__author__ = 'BrianAguirre' def unique_vals(diction): list1 = [] for i in diction: if (diction[i] not in list1): list1.append(diction[i]) return list1 dict1 = {"x":["a", "b", "c"], "y":["a","b"], "z":"b", "c":["a", "b", "c", "d"], "a":["a", "b", "c", "d"]} print(unique_vals(dict1))...
__author__ = 'BrianAguirre' def unique_vals(diction): list1 = [] for i in diction: if diction[i] not in list1: list1.append(diction[i]) return list1 dict1 = {'x': ['a', 'b', 'c'], 'y': ['a', 'b'], 'z': 'b', 'c': ['a', 'b', 'c', 'd'], 'a': ['a', 'b', 'c', 'd']} print(unique_vals(dict1)) ...
def spam(): print(eggs) # ERROR eggs = 'spam local' eggs = 'global' spam()
def spam(): print(eggs) eggs = 'spam local' eggs = 'global' spam()
#Funciones def crea_matrix(rows, cols): matrix = [0] * rows for i in range(rows): matrix[i] = [0] * cols return matrix def crea_matrix2(rows, cols): matrix = [] for i in range(rows): matrix.append([]) for j in range(cols): matrix[i].append(0) return matrix d...
def crea_matrix(rows, cols): matrix = [0] * rows for i in range(rows): matrix[i] = [0] * cols return matrix def crea_matrix2(rows, cols): matrix = [] for i in range(rows): matrix.append([]) for j in range(cols): matrix[i].append(0) return matrix def imprime_...
# ======================== # CREDENTIAL STATUS VALUES # ======================== CRED_VALID = 1 CRED_INVALID = 0 CRED_FAILED = -1 # ====================== # USERNAME STATUS VALUES # ====================== # It's just easier to read when returning multiple values USERNAME_VALID = True USERNAME_INVALID = False...
cred_valid = 1 cred_invalid = 0 cred_failed = -1 username_valid = True username_invalid = False
''' insertion sort ''' def insertion_sort(nums): if len(nums) <= 1: return for i in range(1, len(nums)): for j in range(i, 0, -1): if nums[j] < nums[j-1]: nums[j], nums[j-1] = nums[j-1], nums[j] else: break nums = [125, 8, 0, 65, 23, ...
""" insertion sort """ def insertion_sort(nums): if len(nums) <= 1: return for i in range(1, len(nums)): for j in range(i, 0, -1): if nums[j] < nums[j - 1]: (nums[j], nums[j - 1]) = (nums[j - 1], nums[j]) else: break nums = [125, 8, 0,...
# Chebyshev polynomials T_n(x) on [-1,1] for n=0,1,2,3,4 f0 = lambda x: chebyt(0,x) f1 = lambda x: chebyt(1,x) f2 = lambda x: chebyt(2,x) f3 = lambda x: chebyt(3,x) f4 = lambda x: chebyt(4,x) plot([f0,f1,f2,f3,f4],[-1,1])
f0 = lambda x: chebyt(0, x) f1 = lambda x: chebyt(1, x) f2 = lambda x: chebyt(2, x) f3 = lambda x: chebyt(3, x) f4 = lambda x: chebyt(4, x) plot([f0, f1, f2, f3, f4], [-1, 1])
min = "145852" max = "616942" curr = min def check(val): double = False for i in range(len(val)-1): if val[i] == val[i+1]: double = True if val[i] > val[i+1]: return False return double count = 0 while int(curr) < int(max): if check(curr): count += 1 ...
min = '145852' max = '616942' curr = min def check(val): double = False for i in range(len(val) - 1): if val[i] == val[i + 1]: double = True if val[i] > val[i + 1]: return False return double count = 0 while int(curr) < int(max): if check(curr): count += ...
def enum(**enums): '''From http://stackoverflow.com/a/1695250''' return type('Enum', (), enums) def is_iterable(o): try: iter(o) except TypeError: return False else: return True
def enum(**enums): """From http://stackoverflow.com/a/1695250""" return type('Enum', (), enums) def is_iterable(o): try: iter(o) except TypeError: return False else: return True
def safe_int(x): try: x = int(x) except ValueError: pass return x
def safe_int(x): try: x = int(x) except ValueError: pass return x
def caseless_equal(str_a, str_b): return str_a.casefold() == str_b.casefold() def caseless_list(str_list): return list(map(str.casefold,str_list))
def caseless_equal(str_a, str_b): return str_a.casefold() == str_b.casefold() def caseless_list(str_list): return list(map(str.casefold, str_list))
class SarkException(Exception): pass class SarkError(SarkException): pass class SarkNoSelection(SarkError): pass class SarkNoFunction(SarkError): pass class SarkStructError(SarkError): pass class SarkInvalidRegisterName(SarkError): pass class SarkStructAlreadyExists(SarkStructError):...
class Sarkexception(Exception): pass class Sarkerror(SarkException): pass class Sarknoselection(SarkError): pass class Sarknofunction(SarkError): pass class Sarkstructerror(SarkError): pass class Sarkinvalidregistername(SarkError): pass class Sarkstructalreadyexists(SarkStructError): p...
class Player: LEFT = 0 RIGHT = 1 def __init__(self, left=1, right=1): self.__hand = [left, right] self.__is_dead = False def __get_other_hand(self, hand): return (hand + 1) % 2 def get(self, target_hand): ''' Retrieves value of target hand ''' ...
class Player: left = 0 right = 1 def __init__(self, left=1, right=1): self.__hand = [left, right] self.__is_dead = False def __get_other_hand(self, hand): return (hand + 1) % 2 def get(self, target_hand): """ Retrieves value of target hand """ ...
# # Copyright (c) 2017 Joy Diamond. All rights reserved. # @gem('Sapphire.QuadrupleTwig') def gem(): @share def construct__abcd(t, a, b, c, d): t.a = a t.b = b t.c = c t.d = d @share def count_newlines__abcd(t): return t.a.count_newlines() + t.b.count_newline...
@gem('Sapphire.QuadrupleTwig') def gem(): @share def construct__abcd(t, a, b, c, d): t.a = a t.b = b t.c = c t.d = d @share def count_newlines__abcd(t): return t.a.count_newlines() + t.b.count_newlines() + t.c.count_newlines() + t.d.count_newlines() @share ...
#========================== # Config Parameters #========================== interval_x= 6 interval_y= 6 entry_width= 30 btn_width= 5 btn_hegiht= 1 grp_offsetX= -2 grp_offsetY= -16 interval_rdbox= 60 #=================================================== # Save Path #=================================================== sa...
interval_x = 6 interval_y = 6 entry_width = 30 btn_width = 5 btn_hegiht = 1 grp_offset_x = -2 grp_offset_y = -16 interval_rdbox = 60 save_path = 'Data/' save_para_path = 'Para/' save_scanning_path = savePath + 'Scanning/' save_image_procces_path = savePath + 'ImageProcess/' config_name = 'config.json' scan_index = 'Raw...
try: raise ValueError() except ValueError as v: print("value error", str(v)) except Exception as e: print("hello", str(e)) else: print("hit the else.") finally: print("And finally we're done.")
try: raise value_error() except ValueError as v: print('value error', str(v)) except Exception as e: print('hello', str(e)) else: print('hit the else.') finally: print("And finally we're done.")
#!/usr/bin/python3 # https://practice.geeksforgeeks.org/problems/keypad-typing/0 def sol(s): res="" for x in s: res+=str(km[x]) print(res) km = {"a": 2, "b": 2, "c": 2, "d": 3, "e": 3, "f": 3, "g": 4, "h": 4, "i": 4, "j":5, "k": 5, "l": 5, "m": 6, "n": 6, "o": 6, "p": 7, "q": 7, "r": 7, "s": 7, ...
def sol(s): res = '' for x in s: res += str(km[x]) print(res) km = {'a': 2, 'b': 2, 'c': 2, 'd': 3, 'e': 3, 'f': 3, 'g': 4, 'h': 4, 'i': 4, 'j': 5, 'k': 5, 'l': 5, 'm': 6, 'n': 6, 'o': 6, 'p': 7, 'q': 7, 'r': 7, 's': 7, 't': 8, 'u': 8, 'v': 8, 'w': 9, 'x': 9, 'y': 9, 'z': 9}
# Created by Yonghua # 'return' def square_numbers(num): result = [] for i in num: result.append(i**2) return result my_nums = square_numbers([1,2,3,4,5]) print(my_nums) # or my_nums2 = [x*x for x in [1,2,3,4,5]] print(my_nums2) # 'yield' def square_numbers2(num): for i in num: ...
def square_numbers(num): result = [] for i in num: result.append(i ** 2) return result my_nums = square_numbers([1, 2, 3, 4, 5]) print(my_nums) my_nums2 = [x * x for x in [1, 2, 3, 4, 5]] print(my_nums2) def square_numbers2(num): for i in num: yield (i ** 2) my_nums3 = square_numbers2([...
# 910001000 if not sm.getReturnField() is None: sm.warp(sm.getReturnField()) else: sm.warp(100000000, 19)
if not sm.getReturnField() is None: sm.warp(sm.getReturnField()) else: sm.warp(100000000, 19)
# Params NGROUPS = (11, 25) PITCH = 10.14 NLAT = 19 HALF_FUEL = 6 HALF_REFL = 4 MIDDLE = 0.0 XMIN = -HALF_FUEL * PITCH XMAX = +HALF_FUEL * PITCH YMAX = +PITCH / 2.0 YMIN = -PITCH / 2.0 REFL_ID = 8 FUEL_ID = 9 DATA_DIR = "../inl_mcfuel/heterogeneous/same/" #STATEPOINT = DATA_DIR + "statepoint.100.h5" STATEPOINT = DATA_...
ngroups = (11, 25) pitch = 10.14 nlat = 19 half_fuel = 6 half_refl = 4 middle = 0.0 xmin = -HALF_FUEL * PITCH xmax = +HALF_FUEL * PITCH ymax = +PITCH / 2.0 ymin = -PITCH / 2.0 refl_id = 8 fuel_id = 9 data_dir = '../inl_mcfuel/heterogeneous/same/' statepoint = DATA_DIR + 'statepoint_same.h5' cell_libs = {11: 'cell_lib_1...
#!/usr/bin/env python3 # https://abc075.contest.atcoder.jp/tasks/abc075_c def dfs(g, s, u): s.add(u) if len(s) == len(g): return True for v in g[u]: if v not in s: if dfs(g, s, v): return True return False n, m = map(int, input().split()) e = [] for _ in rang...
def dfs(g, s, u): s.add(u) if len(s) == len(g): return True for v in g[u]: if v not in s: if dfs(g, s, v): return True return False (n, m) = map(int, input().split()) e = [] for _ in range(m): (a, b) = map(int, input().split()) e.append((a - 1, b - 1))...
class Solution: def PredictTheWinner(self, nums): if not nums or len(nums) <= 1: return True dp = [[0] * len(nums) for _ in range(len(nums))] for i in range(len(dp)): dp[i][i] = nums[i] for iteration in range(1, len(dp)): i = 0 for j in...
class Solution: def predict_the_winner(self, nums): if not nums or len(nums) <= 1: return True dp = [[0] * len(nums) for _ in range(len(nums))] for i in range(len(dp)): dp[i][i] = nums[i] for iteration in range(1, len(dp)): i = 0 for j...
data = input() products = {} while not data == "statistics": product_name, product_qty = data.split(": ") if product_name not in products: products[product_name] = int(product_qty) else: products[product_name] += int(product_qty) data = input() print("Products in stock:") for key, ...
data = input() products = {} while not data == 'statistics': (product_name, product_qty) = data.split(': ') if product_name not in products: products[product_name] = int(product_qty) else: products[product_name] += int(product_qty) data = input() print('Products in stock:') for (key, val...
class BadList(list): def __add__(self, other): print("running custom add") return BadList(super(BadList, self).__add__(other)) def __iadd__(self, other): print("running custom iadd") return self + other def plusequals_may_change_pointers(): x = 1 print(id(x)) x +=...
class Badlist(list): def __add__(self, other): print('running custom add') return bad_list(super(BadList, self).__add__(other)) def __iadd__(self, other): print('running custom iadd') return self + other def plusequals_may_change_pointers(): x = 1 print(id(x)) x +=...
# Method One ''' for i in range(0,51): if (i%2 == 0): print(i,"Even") elif(i%2 == 1): print(i,"Odd") ''' # Method Two for i in range (0,51): if (i%2 == 0): print("The Even Numbers are :" ,i) for i in range(0,51): if (i%2 ==1): print("The Odd Numbers are: ",i)
""" for i in range(0,51): if (i%2 == 0): print(i,"Even") elif(i%2 == 1): print(i,"Odd") """ for i in range(0, 51): if i % 2 == 0: print('The Even Numbers are :', i) for i in range(0, 51): if i % 2 == 1: print('The Odd Numbers are: ', i)
class Solution: def longestMountain(self, A: List[int]) -> int: i=0 j=0 N=len(A) result=0 while i<N: j=i if j+1<N and A[j]<A[j+1]: while j+1<N and A[j]<A[j+1]: j+=1 if j+1<N and A[j]>A[j+1]: ...
class Solution: def longest_mountain(self, A: List[int]) -> int: i = 0 j = 0 n = len(A) result = 0 while i < N: j = i if j + 1 < N and A[j] < A[j + 1]: while j + 1 < N and A[j] < A[j + 1]: j += 1 if ...
with open('./Input/Letters/starting_letter.txt') as file: starting_letter = file.read() with open('./Input/Names/invited_names.txt') as file: names = file.readlines() # For each name in invited_names.txt for name in names: name = str(name).strip() # Replace the [name] placeholder with the actual name....
with open('./Input/Letters/starting_letter.txt') as file: starting_letter = file.read() with open('./Input/Names/invited_names.txt') as file: names = file.readlines() for name in names: name = str(name).strip() new_letter = starting_letter.replace('[name]', name) with open(f'./Output/ReadyToSend/{na...
class Paciente: def __init__(self, nome: str, cpf: str, receita: dict): self.nome = nome self.cpf = cpf self.receita = receita def __str__(self): return f"Nome: {self.nome}\nCPF: {self.cpf}\nReceita: {self.receita}\n"
class Paciente: def __init__(self, nome: str, cpf: str, receita: dict): self.nome = nome self.cpf = cpf self.receita = receita def __str__(self): return f'Nome: {self.nome}\nCPF: {self.cpf}\nReceita: {self.receita}\n'
class Simple: def __enter__(self): print("In __enter__ method") return "Simple" def __exit__(self, type, value, trace): print("In __exit__ method") print(type) print(value) print(trace) def get_simple(): return Simple() with get_simple() as simple: pr...
class Simple: def __enter__(self): print('In __enter__ method') return 'Simple' def __exit__(self, type, value, trace): print('In __exit__ method') print(type) print(value) print(trace) def get_simple(): return simple() with get_simple() as simple: prin...
class Memory(object): ''' The base class of Memory, with the core methods ''' def __init__(self, env_spec, **kwargs): # absorb generic param without breaking '''Construct externally, and set at Agent.compile()''' self.env_spec = env_spec self.agent = None self.state = ...
class Memory(object): """ The base class of Memory, with the core methods """ def __init__(self, env_spec, **kwargs): """Construct externally, and set at Agent.compile()""" self.env_spec = env_spec self.agent = None self.state = None def reset_state(self, init_state...
# User RECORD_ID = 'record_id' EMAIL_ADDRESS = 'email' ENTRY_CODE = 'entry_code' APPROVED = 'approved' FNAME = 'user_fname' LNAME = 'user_lname' # EHR EHR_COMPLETE = 'ehr_complete' EHR_Q1 = 'ehr_q1' ehr_fields = [ EHR_Q1 ] # EHR_Q2 = 'ehr_q2' # EHR_Q3 = 'ehr_q3' # EHR_Q4 = 'ehr_q4' # EHR_Q5 = 'ehr_q5' # EHR_Q6A = 'e...
record_id = 'record_id' email_address = 'email' entry_code = 'entry_code' approved = 'approved' fname = 'user_fname' lname = 'user_lname' ehr_complete = 'ehr_complete' ehr_q1 = 'ehr_q1' ehr_fields = [EHR_Q1]
class Solution: def twoSum(self, nums, target): # for i, c in enumerate(nums): # if target - c in nums and c * 2 != target: # return [i, nums.index(target - c)] # return [] # Time - O(n^2) 1200ms # Space - O(1) # num_to_index = {} # for i...
class Solution: def two_sum(self, nums, target): num_to_index = {} for (i, c) in enumerate(nums): if target - c in num_to_index: return [num_to_index[target - c], i] num_to_index[c] = i return []
# Question: Create an English to Portuguese translation program. # The program takes a word from the user as input and translates it using the following dictionary as # a vocabulary source. In addition, return the message "We couldn't find that word!" # when the user enters a word that is not in the dictionary. # A...
d = dict(weather='clima', earth='terra', rain='chuva') def vocab(word): try: return d[word.lower()] except KeyError: return "We couldn't find that word!" user_input = input('Enter word: ') print(vocab(user_input))
class Solution: def isInterleave(self, s1: str, s2: str, s3: str) -> bool: s1Len, s2Len, s3Len = len(s1), len(s2), len(s3) if s1Len + s2Len != s3Len: return False dp = [False] * (s2Len + 1) for i in range(s1Len + 1): for j in range(s2Len + 1): ...
class Solution: def is_interleave(self, s1: str, s2: str, s3: str) -> bool: (s1_len, s2_len, s3_len) = (len(s1), len(s2), len(s3)) if s1Len + s2Len != s3Len: return False dp = [False] * (s2Len + 1) for i in range(s1Len + 1): for j in range(s2Len + 1): ...
map = { '0': 'PROXYCITY', '1': 'P.Y.N.G.', '2': 'DNSUEY!', '3': 'SERVERS', '4': 'HOST!', '5': 'CRIPTONIZE', '6': 'OFFLINE DAY', '7': 'SALT', '8': 'ANSWER!', '9': 'RAR?', '10': 'WIFI ANTENNAS' } result = [] def show_map(loop): for i in range(loop): music = input(...
map = {'0': 'PROXYCITY', '1': 'P.Y.N.G.', '2': 'DNSUEY!', '3': 'SERVERS', '4': 'HOST!', '5': 'CRIPTONIZE', '6': 'OFFLINE DAY', '7': 'SALT', '8': 'ANSWER!', '9': 'RAR?', '10': 'WIFI ANTENNAS'} result = [] def show_map(loop): for i in range(loop): music = input() music = music.split(' ') resu...
n, c = map(int, input().split()) lst, ans = [], 0 for i in range(n): lst.append(int(input())) lst.sort() start = lst[1]-lst[0] end = lst[len(lst)-1]-lst[0] while start <= end: first = lst[0] mid, temp = (start+end)//2, 1 for i in range(1, n): if lst[i]-first >= mid: temp += 1 ...
(n, c) = map(int, input().split()) (lst, ans) = ([], 0) for i in range(n): lst.append(int(input())) lst.sort() start = lst[1] - lst[0] end = lst[len(lst) - 1] - lst[0] while start <= end: first = lst[0] (mid, temp) = ((start + end) // 2, 1) for i in range(1, n): if lst[i] - first >= mid: ...
# Optimal Subsrting test # Implementing KNP Algorithm def KnuthMorrisPratt(text, pattern): pattern = list(pattern) # Shifting Table for pattern shifts = [1] * (len(pattern) + 1) j = 1 for i in range(len(pattern)): while j <= i and pattern[i] != pattern[i - j]: j += 1 sh...
def knuth_morris_pratt(text, pattern): pattern = list(pattern) shifts = [1] * (len(pattern) + 1) j = 1 for i in range(len(pattern)): while j <= i and pattern[i] != pattern[i - j]: j += 1 shifts[i + 1] = j results = [] start_index = 0 match_len = 0 for char in ...
# # PySNMP MIB module DPS-MIB-CG-V1 (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DPS-MIB-CG-V1 # Produced by pysmi-0.3.4 at Wed May 1 12:54:10 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, constraints_intersection, value_size_constraint) ...
class Solution: def removeDuplicates(self, nums) -> int: prev = None i = 0 while nums: if prev == nums[i]: nums.pop(i-1) else: prev = nums[i] i+=1 if i == len(nums): break ...
class Solution: def remove_duplicates(self, nums) -> int: prev = None i = 0 while nums: if prev == nums[i]: nums.pop(i - 1) else: prev = nums[i] i += 1 if i == len(nums): break return...
# # PySNMP MIB module EATON-EPDU-PU-MI-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EATON-EPDU-PU-MI-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:44:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, constraints_intersection, value_size_constraint, value_range_constraint) ...
[ init.init, init2.init ]
[init.init, init2.init]
# # @lc app=leetcode id=345 lang=python3 # # [345] Reverse Vowels of a String # # @lc code=start class Solution: def reverseVowels(self, s: str) -> str: # Accepted # 481/481 cases passed (68 ms) # Your runtime beats 43.67 % of python3 submissions # Your memory usage beats 6.67 % o...
class Solution: def reverse_vowels(self, s: str) -> str: (vowwels, n, l, chars) = (('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'), 0, len(s), []) for i in s: if i in vowwels: chars += [i] s = list(s) if chars: while n < l: ...
weight=1 def run(): lfliper(0) rfliper(0) sleep(2) rfliper(1) lfliper(1) sleep(2) rfliper(2) lfliper(2) sleep(2) rfliper(1) lfliper(1) sleep(2) rfliper(0) lfliper(0)
weight = 1 def run(): lfliper(0) rfliper(0) sleep(2) rfliper(1) lfliper(1) sleep(2) rfliper(2) lfliper(2) sleep(2) rfliper(1) lfliper(1) sleep(2) rfliper(0) lfliper(0)
## Constants # ESP32 Hardware SPI Buses HSPI = const(1) VSPI = const(2) # Miscelleanous DEFAULT_BAUDRATE = const(42000000) TFTWIDTH = const(240) # TFT Width TFTHEIGHT = const(320) # TFT Height # IlI9341 registers definitions # LCD control registers NOP = const...
hspi = const(1) vspi = const(2) default_baudrate = const(42000000) tftwidth = const(240) tftheight = const(320) nop = const(0) swreset = const(1) rddid = const(4) rddst = const(9) rddpm = const(10) rddmadctl = const(11) rdpixfmt = const(12) rddim = const(13) rddsm = const(14) rddsdr = const(15) rdid1 = const(218) rdid2...
def valid_module_code(module_code: str): if not module_code: return False if len(module_code) != 7: return False return True def valid_assessment_id(assessment_id: str): if not assessment_id: return False if not assessment_id.upper()[0] == "A": return False ...
def valid_module_code(module_code: str): if not module_code: return False if len(module_code) != 7: return False return True def valid_assessment_id(assessment_id: str): if not assessment_id: return False if not assessment_id.upper()[0] == 'A': return False retur...
class Solution: def distributeCandies(self, candyType: List[int]) -> int: m = len(set(candyType)); n = len(candyType)//2 if m > n: return n return m
class Solution: def distribute_candies(self, candyType: List[int]) -> int: m = len(set(candyType)) n = len(candyType) // 2 if m > n: return n return m
# Write your solution here def new_person(name: str, age: int): x = name.split() if (len(x) < 2 or len(name) not in range(2,41) or age not in range(0,151) ): raise ValueError("Invalid parameters") return (name, age) if __name__ == "__main__": #print(new_person('Andrew', 32)) print(new_person...
def new_person(name: str, age: int): x = name.split() if len(x) < 2 or len(name) not in range(2, 41) or age not in range(0, 151): raise value_error('Invalid parameters') return (name, age) if __name__ == '__main__': print(new_person('James Jameson', 32))
def get_schema(flavor, primary_key="npl_publn_id", pk_type="number"): assert flavor in ["npl", "pat"] if flavor == "npl": schema = { "type": "object", "properties": { primary_key: {"type": pk_type}, "DOI": {"type": "string"}, "ISSN"...
def get_schema(flavor, primary_key='npl_publn_id', pk_type='number'): assert flavor in ['npl', 'pat'] if flavor == 'npl': schema = {'type': 'object', 'properties': {primary_key: {'type': pk_type}, 'DOI': {'type': 'string'}, 'ISSN': {'type': 'string'}, 'ISSNe': {'type': 'string'}, 'PMCID': {'type': 'stri...
# Return the number of even ints in the given array. # count_evens([2, 1, 2, 3, 4]) --> 3 # count_evens([2, 2, 0]) --> 3 # count_evens([1, 3, 5]) --> 0 def count_evens(nums): count = 0 for i in nums: if i % 2 == 0: count += 1 return count print(count_evens([2, 1, 2, 3, 4])) print(count_evens([2, 2, 0...
def count_evens(nums): count = 0 for i in nums: if i % 2 == 0: count += 1 return count print(count_evens([2, 1, 2, 3, 4])) print(count_evens([2, 2, 0])) print(count_evens([1, 3, 5]))
USERNAME = "email1" PASSWORD = "password1" MAINUSERNAME = "email2" MAINPASSWORD = "password2"
username = 'email1' password = 'password1' mainusername = 'email2' mainpassword = 'password2'
class Solution: def cleanRoom(self, robot): def dfs(robot,cpos,cdir) : visited.add(cpos) robot.clean() for i in range(4): nextDir = (cdir + i) % 4 npos = (cpos[0] + steps[nextDir][0] , cpos[1] + steps[nextDir][1]) if npos ...
class Solution: def clean_room(self, robot): def dfs(robot, cpos, cdir): visited.add(cpos) robot.clean() for i in range(4): next_dir = (cdir + i) % 4 npos = (cpos[0] + steps[nextDir][0], cpos[1] + steps[nextDir][1]) if npo...
#!/usr/bin/env python files = [ "1.webp", "2.webp", "3.webp", "4.webp" ] for f in files: command = command + info_command (OIIO_TESTSUITE_IMAGEDIR + "/" + f)
files = ['1.webp', '2.webp', '3.webp', '4.webp'] for f in files: command = command + info_command(OIIO_TESTSUITE_IMAGEDIR + '/' + f)
step=1 def hanoi(num,src,tmp,dst): global step if num==1: print("step",step,": move from "+src+" to "+dst+" ;") step=step+1 else: hanoi(num-1,src,dst,tmp) print("step",step,": move from "+src+" to "+dst+" ;") step=step+1 hanoi(num-1,tmp,src,dst) han...
step = 1 def hanoi(num, src, tmp, dst): global step if num == 1: print('step', step, ': move from ' + src + ' to ' + dst + ' ;') step = step + 1 else: hanoi(num - 1, src, dst, tmp) print('step', step, ': move from ' + src + ' to ' + dst + ' ;') step = step + 1 ...
def knapsack(capacity, items): sorted_items = sorted(enumerate(items), key = lambda item: item[1][1]/item[1][0], reverse = True) # enumerate to preserve indexes, sort by value/size ratio take = [0]*len(items) # output, once incremented i = 0 # index in sorted list while capacity > 0 and i < len(items): ...
def knapsack(capacity, items): sorted_items = sorted(enumerate(items), key=lambda item: item[1][1] / item[1][0], reverse=True) take = [0] * len(items) i = 0 while capacity > 0 and i < len(items): (i_original, item) = sorted_items[i] can_carry = capacity // item[0] take[i_original...
while True: try: N = int(input()) tc = 4; for num in range(4, N+4): if tc > 4: print('') M = int(input()) m = [] sz = [0] * M for i in range(M): m.append(list(map(int, input().split()))) ...
while True: try: n = int(input()) tc = 4 for num in range(4, N + 4): if tc > 4: print('') m = int(input()) m = [] sz = [0] * M for i in range(M): m.append(list(map(int, input().split()))) ...
# File: recordedfuture_consts.py # # Copyright (c) Recorded Future, Inc, 2019-2022 # # This unpublished material is proprietary to Recorded Future. All # rights reserved. The methods and techniques described herein are # considered trade secrets and/or confidential. Reproduction or # distribution, in whole or in part,...
version = '3.1.0' buildid = '264' timeout = 33 intelligence_map = {'ip': ('/ip/%s', ['entity', 'risk', 'timestamps', 'threatLists', 'intelCard', 'metrics', 'location', 'relatedEntities'], 'ip', False), 'domain': ('/domain/idn:%s', ['entity', 'risk', 'timestamps', 'threatLists', 'intelCard', 'metrics', 'relatedEntities'...
characterMapVanessa = { "vanessa_base_001": "vanessa_base_001", # Auto: Edited "vanessa_base_002": "vanessa_base_002", # Auto: Edited "vanessa_base_003": "vanessa_base_003", # Auto: Edited...
character_map_vanessa = {'vanessa_base_001': 'vanessa_base_001', 'vanessa_base_002': 'vanessa_base_002', 'vanessa_base_003': 'vanessa_base_003', 'vanessa_base_be1_001': 'vanessa_be1_001', 'vanessa_base_be1_002': 'vanessa_be1_002', 'vanessa_base_be1_003': 'vanessa_be1_003', 'vanessa_base_breast_003': 'vanessa_be0_003', ...
def abbr_on_template(template_text, template_tags): text = template_text for tag, value in template_tags.items(): text = template_text.replace("{{" + tag + "}}", "<abbr title=\"" + value + "\">{{" + tag + "}}</abbr>") text = text.replace("\n", "<br>") return text
def abbr_on_template(template_text, template_tags): text = template_text for (tag, value) in template_tags.items(): text = template_text.replace('{{' + tag + '}}', '<abbr title="' + value + '">{{' + tag + '}}</abbr>') text = text.replace('\n', '<br>') return text