content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
''' core exception module ''' class ConversionUnitNotImplemented(Exception): ''' raises when tring can not convert a TemperatureUnit ''' def __init__(self, unit_name: str): super().__init__('Conversion unit %s not implemented' % unit_name)
""" core exception module """ class Conversionunitnotimplemented(Exception): """ raises when tring can not convert a TemperatureUnit """ def __init__(self, unit_name: str): super().__init__('Conversion unit %s not implemented' % unit_name)
line, k = input(), int(input()) iterator = line.__iter__() iterators = zip(*([iterator] * k)) for word in iterators: d = dict() result = ''.join([d.setdefault(letter, letter) for letter in word if letter not in d]) print(result)
(line, k) = (input(), int(input())) iterator = line.__iter__() iterators = zip(*[iterator] * k) for word in iterators: d = dict() result = ''.join([d.setdefault(letter, letter) for letter in word if letter not in d]) print(result)
e_h,K = map(int,input().split()) h,m,s,e_m,e_s,ans = 0,0,0,59,59,0 while e_h != h or e_m != m or e_s != s: z = "%02d%02d%02d" % (h,m,s) if z.count(str(K)) >0: # print(z) ans+=1 s+=1 if s==60: m+=1 s=0 if m==60: h+=1 m=0 z = "%02d%02d%02d" % (h,m,s) ...
(e_h, k) = map(int, input().split()) (h, m, s, e_m, e_s, ans) = (0, 0, 0, 59, 59, 0) while e_h != h or e_m != m or e_s != s: z = '%02d%02d%02d' % (h, m, s) if z.count(str(K)) > 0: ans += 1 s += 1 if s == 60: m += 1 s = 0 if m == 60: h += 1 m = 0 z = '%02d%02d%...
# # 9608/22/PRE/O/N/2020 # The code below declares the variables and arrays that are supposed to be pre-populated. ItemCode = ["1001", "6056", "5557", "2568", "4458"] ItemDescription = ["Pencil", "Pen", "Notebook", "Ruler", "Compass"] Price = [1.0, 10.0, 100.0, 20.0, 30.0] NumberInStock = [100, 100, 50, 20, 20] n = ...
item_code = ['1001', '6056', '5557', '2568', '4458'] item_description = ['Pencil', 'Pen', 'Notebook', 'Ruler', 'Compass'] price = [1.0, 10.0, 100.0, 20.0, 30.0] number_in_stock = [100, 100, 50, 20, 20] n = len(ItemCode) threshold_level = int(input('Enter the minumum stock level: ')) for counter in range(n): if Numb...
# 4.04 Lists # Purpose: learning how to use lists # # Author@ Shawn Velsor # Date: 1/8/2021 electronics = ["computer", "cellphone", "laptop", "headphones"] mutualItem = False print("Hello, these are the items I like:") count = 1 for i in electronics: print(str(count) + ".", i) count += 1 print() def main()...
electronics = ['computer', 'cellphone', 'laptop', 'headphones'] mutual_item = False print('Hello, these are the items I like:') count = 1 for i in electronics: print(str(count) + '.', i) count += 1 print() def main(): item = input('What type of electronic device do you like? ').lower() for i in electro...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Peter Mounce <public@neverrunwithscissors.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version...
ansible_metadata = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} documentation = '\n---\nmodule: win_webpicmd\nversion_added: "2.0"\nshort_description: Installs packages using Web Platform Installer command-line\ndescription:\n - Installs packages using Web Platform Installer comman...
# ==== PATHS =================== PATH_TO_DATASET = "houseprice.csv" OUTPUT_SCALER_PATH = 'scaler.pkl' OUTPUT_MODEL_PATH = 'lasso_regression.pkl' # ======= PARAMETERS =============== # imputation parameters LOTFRONTAGE_MODE = 60 # encoding parameters FREQUENT_LABELS = { 'MSZoning': ['FV', 'RH', 'RL', 'RM'],...
path_to_dataset = 'houseprice.csv' output_scaler_path = 'scaler.pkl' output_model_path = 'lasso_regression.pkl' lotfrontage_mode = 60 frequent_labels = {'MSZoning': ['FV', 'RH', 'RL', 'RM'], 'Neighborhood': ['Blmngtn', 'BrDale', 'BrkSide', 'ClearCr', 'CollgCr', 'Crawfor', 'Edwards', 'Gilbert', 'IDOTRR', 'MeadowV', 'Mit...
__title__ = 'plinn' __description__ = "Partition Like It's 1999" __url__ = 'https://github.com/giannitedesco/plinn' __author__ = 'Gianni Tedesco' __author_email__ = 'gianni@scaramanga.co.uk' __copyright__ = 'Copyright 2020 Gianni Tedesco' __license__ = 'Apache 2.0' __version__ = '0.0.2'
__title__ = 'plinn' __description__ = "Partition Like It's 1999" __url__ = 'https://github.com/giannitedesco/plinn' __author__ = 'Gianni Tedesco' __author_email__ = 'gianni@scaramanga.co.uk' __copyright__ = 'Copyright 2020 Gianni Tedesco' __license__ = 'Apache 2.0' __version__ = '0.0.2'
# 2. Write Python code to find the cost of the minimum-energy seam in a list of lists. energies = [[24, 22, 30, 15, 18, 19], [12, 23, 15, 23, 10, 15], [11, 13, 22, 13, 21, 14], [13, 15, 17, 28, ...
energies = [[24, 22, 30, 15, 18, 19], [12, 23, 15, 23, 10, 15], [11, 13, 22, 13, 21, 14], [13, 15, 17, 28, 19, 21], [17, 17, 7, 27, 20, 19]] energies2 = [[24, 22, 30, 15, 18, 19], [12, 23, 15, 23, 10, 15], [11, 13, 22, 13, 21, 14], [13, 15, 17, 28, 19, 21], [17, 17, 29, 27, 20, 19]] def min_energy(energies): cost ...
mqtt_host = "IP_OR_DOMAIN" mqtt_port = 1883 mqtt_topic = "screen/rpi" mqtt_username = "USERNAME" mqtt_password = "PASSWORD" # Raspberry Pi power_on_command = "vcgencmd display_power 1" power_off_command = "vcgencmd display_power 0" # Other HDMI linux devices # power_on_command = "xset -display :0 dpms force on" # power...
mqtt_host = 'IP_OR_DOMAIN' mqtt_port = 1883 mqtt_topic = 'screen/rpi' mqtt_username = 'USERNAME' mqtt_password = 'PASSWORD' power_on_command = 'vcgencmd display_power 1' power_off_command = 'vcgencmd display_power 0'
# Child Prime is such a prime number which can be obtained by summing up the square of the digit of its parent prime number. # For example, 23 is a prime. If we calculate 2^2+3^2 = 4+9 = 13, which is also a prime no. then we call 13 as a child prime of 23. ul = int(input("Enter Upper Limit: ")) gt = int(input("Genera...
ul = int(input('Enter Upper Limit: ')) gt = int(input('Generation Thresold :')) def is_prime(m): q = len(factors(m)) if q == 2: return True else: return False def sep(num): res = list(map(int, str(num))) return res def factors(n): flist = [] for i in range(1, n + 1): ...
class MissingVariableError(Exception): def __init__(self, name): self.name = name self.message = f'The required variable "{self.name}" is missing' super().__init__(self.message) class ReservedVariableError(Exception): def __init__(self, name): self.name = name self.mess...
class Missingvariableerror(Exception): def __init__(self, name): self.name = name self.message = f'The required variable "{self.name}" is missing' super().__init__(self.message) class Reservedvariableerror(Exception): def __init__(self, name): self.name = name self.mes...
def main(): # input a, b, c = map(int, input().split()) # compute cnt = 0 for i in range(a, b+1): if c%i == 0: cnt += 1 # output print(cnt) if __name__ == "__main__": main()
def main(): (a, b, c) = map(int, input().split()) cnt = 0 for i in range(a, b + 1): if c % i == 0: cnt += 1 print(cnt) if __name__ == '__main__': main()
########################################################################################## # district data structure ########################################################################################## class DistrictData: def __init__(self): self.data = "" self.stato = "" self.c...
class Districtdata: def __init__(self): self.data = '' self.stato = '' self.codice_regione = '' self.denominazione_regione = '' self.codice_provincia = '' self.denominazione_provincia = '' self.sigla_provincia = '' self.lat = '' self.long = ''...
# -*- coding: utf-8 -*- while True: try: hm = list(map(float, input().split())) h = int((hm[0] / 360) * 12) m = int((hm[1] / 360) * 60) if m == 60: m = 0 print("{:02d}:{:02d}".format(h, m)) except (EOFError, IndexError): break
while True: try: hm = list(map(float, input().split())) h = int(hm[0] / 360 * 12) m = int(hm[1] / 360 * 60) if m == 60: m = 0 print('{:02d}:{:02d}'.format(h, m)) except (EOFError, IndexError): break
class Solution: def rob(self, root): def f(n): if not n: return [0, 0] l, r = f(n.left), f(n.right) return [l[1] + r[1], max(l[1] + r[1], n.val + l[0] + r[0])] return max(f(root))
class Solution: def rob(self, root): def f(n): if not n: return [0, 0] (l, r) = (f(n.left), f(n.right)) return [l[1] + r[1], max(l[1] + r[1], n.val + l[0] + r[0])] return max(f(root))
''' If the parameter to the make payment method of the CreditCard class were a negative number, that would have the effect of raising the balance on the account. Revise the implementation so that it raises a ValueError if a negative value is sent. ''' def make_payment(self,amount): if amount < 0: raise ValueError(...
""" If the parameter to the make payment method of the CreditCard class were a negative number, that would have the effect of raising the balance on the account. Revise the implementation so that it raises a ValueError if a negative value is sent. """ def make_payment(self, amount): if amount < 0: raise va...
x = 3 def foo(): y = "String" return y foo()
x = 3 def foo(): y = 'String' return y foo()
n = int(input()) for i in range(n): r,e,c = map(int, input().split()) if((e-c) > r): print('advertise') elif((e-c) == r): print('does not matter') else: print('do not advertise')
n = int(input()) for i in range(n): (r, e, c) = map(int, input().split()) if e - c > r: print('advertise') elif e - c == r: print('does not matter') else: print('do not advertise')
def sum(*args): total = 0 for arg in args: total+= arg return total a = sum(1200, 300, 500) print(a)
def sum(*args): total = 0 for arg in args: total += arg return total a = sum(1200, 300, 500) print(a)
#1) def isnegative(n): if n < 0: return True else: return False isnegative(-6) #1) list1 = [1,2,3] def count_evens(list1): even_count = 0 for num in list1: if num % 2 == 0: even_count += 1 print(even_count) #1) def increment_odds(n): nums = [] for n in ...
def isnegative(n): if n < 0: return True else: return False isnegative(-6) list1 = [1, 2, 3] def count_evens(list1): even_count = 0 for num in list1: if num % 2 == 0: even_count += 1 print(even_count) def increment_odds(n): nums = [] for n in range(1, 2 * n,...
N = int(input()) while N > 0: texto = input().lower().replace(' ', '') alfabeto = 'abcdefghijklmnopqrstuvwxyz' contador = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] result = '' a, i, count, maior = 0, 0, 0, 0 break_ = True while count < 52: if break_ == True: c...
n = int(input()) while N > 0: texto = input().lower().replace(' ', '') alfabeto = 'abcdefghijklmnopqrstuvwxyz' contador = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] result = '' (a, i, count, maior) = (0, 0, 0, 0) break_ = True while count < 52: if ...
# Schema used for pre-2013-2014 TAPR data SCHEMA = { 'staff-and-student-information': { 'all_students_count': 'PETALLC', 'african_american_count': 'PETBLAC', 'african_american_percent': 'PETBLAP', 'american_indian_count': 'PETINDC', 'american_indian_percent': 'PETINDP', ...
schema = {'staff-and-student-information': {'all_students_count': 'PETALLC', 'african_american_count': 'PETBLAC', 'african_american_percent': 'PETBLAP', 'american_indian_count': 'PETINDC', 'american_indian_percent': 'PETINDP', 'asian_count': 'PETASIC', 'asian_percent': 'PETASIP', 'hispanic_count': 'PETHISC', 'hispanic_...
# Leo colorizer control file for bbj mode. # This file is in the public domain. # Properties for bbj mode. properties = { "commentEnd": "*/", "commentStart": "/*", "wordBreakChars": ",+-=<>/?^&*", } # Attributes dict for bbj_main ruleset. bbj_main_attributes_dict = { "default": "null", ...
properties = {'commentEnd': '*/', 'commentStart': '/*', 'wordBreakChars': ',+-=<>/?^&*'} bbj_main_attributes_dict = {'default': 'null', 'digit_re': '', 'escape': '\\', 'highlight_digits': 'true', 'ignore_case': 'true', 'no_word_sep': ''} attributes_dict_dict = {'bbj_main': bbj_main_attributes_dict} bbj_main_keywords_di...
# # Time complexity: # O(lines*columns) (worst case, where all the neighbours have the same color) # O(1) (best case, where no neighbour has the same color) # # Space complexity: # O(1) (color changes applied in place) # def flood_fill(screen, lines, columns, line, column, color): def inbound(l, c)...
def flood_fill(screen, lines, columns, line, column, color): def inbound(l, c): return (l >= 0 and l < lines) and (c >= 0 and c < columns) def key(l, c): return '{},{}'.format(l, c) stack = [[line, column]] visited = set() while stack: (l, c) = stack.pop() visited.a...
def __residuumSign(self): if self.outcome == 0: return -1 else: return 1
def __residuum_sign(self): if self.outcome == 0: return -1 else: return 1
# -*- coding: utf-8 -*- class RedisServiceException(Exception): pass
class Redisserviceexception(Exception): pass
class Solution: def minStickers(self, stickers: List[str], target: str) -> int: n = len(target) maxMask = 1 << n # dp[i] := min # of stickers to spell out i, # where i is the bit representation of target dp = [math.inf] * maxMask dp[0] = 0 for mask in range(maxMask): if dp[mask] == ...
class Solution: def min_stickers(self, stickers: List[str], target: str) -> int: n = len(target) max_mask = 1 << n dp = [math.inf] * maxMask dp[0] = 0 for mask in range(maxMask): if dp[mask] == math.inf: continue for sticker in sticker...
# ----------------------------------------------------------- # Copyright (c) 2021. Danil Smirnov # A positive real number is given. Print its fractional part. # ----------------------------------------------------------- def get_fractional_part(number: float)-> float: return float(number - (int(number ...
def get_fractional_part(number: float) -> float: return float(number - int(number // 1)) print(get_fractional_part(float(input())))
def hello(): print(f"Hello, world!") if __name__ == '__main__': hello()
def hello(): print(f'Hello, world!') if __name__ == '__main__': hello()
variant = dict( mlflow_uri="http://128.2.210.74:8080", gpu=False, algorithm="PPO", version="normal", actor_width=64, # Need to tune critic_width=256, replay_buffer_size=int(3E3), algorithm_kwargs=dict( min_num_steps_before_training=0, num_epoch...
variant = dict(mlflow_uri='http://128.2.210.74:8080', gpu=False, algorithm='PPO', version='normal', actor_width=64, critic_width=256, replay_buffer_size=int(3000.0), algorithm_kwargs=dict(min_num_steps_before_training=0, num_epochs=150, num_eval_steps_per_epoch=1000, num_train_loops_per_epoch=10, num_expl_steps_per_tra...
# # PySNMP MIB module ENTERASYS-RADIUS-ACCT-CLIENT-EXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ENTERASYS-RADIUS-ACCT-CLIENT-EXT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:50:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # U...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, constraints_union, single_value_constraint, value_range_constraint) ...
par = [] impar = [] print('Para o inicio da contagem, inicie com 1 para mostrar os impares e 2 para os pares.') n1 = int(input('Digite o inico da contagem [ 1 ] [ 2 ]:')) n2 = int(input('Digite o final da contagem:')) for c in range(n1, n2+1, 2): if n1 == 2: par.append(c) elif n1 == 1: impar.app...
par = [] impar = [] print('Para o inicio da contagem, inicie com 1 para mostrar os impares e 2 para os pares.') n1 = int(input('Digite o inico da contagem [ 1 ] [ 2 ]:')) n2 = int(input('Digite o final da contagem:')) for c in range(n1, n2 + 1, 2): if n1 == 2: par.append(c) elif n1 == 1: impar.a...
# Crie um programa onde o usuario digite # uma expressao qualquer que use parenteses. # Seu aplicativo devera analisar se a # expressao passada esta com os # parenteses abertos e fechados na ordem correta. expr = str(input('Digite a expressao: ')) pilha = list() for simb in expr: if simb == '(': pilha.appen...
expr = str(input('Digite a expressao: ')) pilha = list() for simb in expr: if simb == '(': pilha.append('(') elif simb == ')': if len(pilha) > 0: pilha.pop() else: pilha.append(')') break if len(pilha) == 0: print('Sua expressao esta valida!') else...
# Python Program To Sort The Elements Of A Dictionary Based On A Key Or Value ''' Function Name : Sort Elements Of Dictionary Based On Key, Value. Function Date : 13 Sep 2020 Function Author : Prasad Dangare Input : String Output : String ''' colors = {10: "Red", 35: "Green"...
""" Function Name : Sort Elements Of Dictionary Based On Key, Value. Function Date : 13 Sep 2020 Function Author : Prasad Dangare Input : String Output : String """ colors = {10: 'Red', 35: 'Green', 15: 'Blue', 25: 'White'} c1 = sorted(colors.items(), key=lambda t: t[0]) print(c1) c2 = ...
# Mergesort is the best sorting algorithm for use with a linked-list # Time Complexity O(nlogn) # Merging will require log(n) doublings from subarrays of size (1) to a single array of size length(n), # where each pass will require (n) iterations to compare and sort each element # Space Complexity O(n) arrays ...
def mergesort(a): if len(a) > 1: m = len(a) // 2 l = a[:m] r = a[m:] mergesort(l) mergesort(r) i = 0 j = 0 k = 0 while i < len(l) and j < len(r): if l[i] < r[j]: a[k] = l[i] i += 1 else: ...
def solution(inp): data = [row.split() for row in inp.splitlines()] count = 0 for passphrase in data: if len(passphrase) == len(set(passphrase)): count = count + 1 return count def main(): with open('input.txt', 'r') as f: inp = f.read() print('[*] Reading input from input.txt...') print('[*] The soluti...
def solution(inp): data = [row.split() for row in inp.splitlines()] count = 0 for passphrase in data: if len(passphrase) == len(set(passphrase)): count = count + 1 return count def main(): with open('input.txt', 'r') as f: inp = f.read() print('[*] Reading input ...
# -*- coding: utf-8 -*- __author__ = "venkat" __author_email__ = "venkatram0273@gmail.com"
__author__ = 'venkat' __author_email__ = 'venkatram0273@gmail.com'
s1=set([1,3,7,94]) s2=set([2,3]) print(s1) print(s2) print(s1.intersection(s2)) print(s1.difference(s2)) print(s2.difference(s1)) print(s1.symmetric_difference(s2)) print(s1.union(s2)) s1.difference_update(s2) #S1 becomes equal to the difference print(s1) s1=set([1,3]) s1.discard(1) s1.remove(3) print(s1) s1.add(5) pr...
s1 = set([1, 3, 7, 94]) s2 = set([2, 3]) print(s1) print(s2) print(s1.intersection(s2)) print(s1.difference(s2)) print(s2.difference(s1)) print(s1.symmetric_difference(s2)) print(s1.union(s2)) s1.difference_update(s2) print(s1) s1 = set([1, 3]) s1.discard(1) s1.remove(3) print(s1) s1.add(5) print(s1) t = [6, 7] s2.upda...
def convert_to_alt_caps(message): lower = message.lower() upper = message.upper() data = [] space_offset = 0 for i in range(len(lower)): if not lower[i].isalpha(): space_offset += 1 if (i + space_offset) % 2 == 0: data.append(lower[i]) else: ...
def convert_to_alt_caps(message): lower = message.lower() upper = message.upper() data = [] space_offset = 0 for i in range(len(lower)): if not lower[i].isalpha(): space_offset += 1 if (i + space_offset) % 2 == 0: data.append(lower[i]) else: ...
TIME_FORMAT = ('day', 'hour') OPERATORS = { '==': lambda x, y: x == y, '<=': lambda x, y: x <= y, '>=': lambda x, y: x >= y, '>': lambda x, y: x > y, '<': lambda x, y: x < y, } class TimeDelta(object): def __init__(self, amount, fmt, operator): if int(amount) < 0: raise ...
time_format = ('day', 'hour') operators = {'==': lambda x, y: x == y, '<=': lambda x, y: x <= y, '>=': lambda x, y: x >= y, '>': lambda x, y: x > y, '<': lambda x, y: x < y} class Timedelta(object): def __init__(self, amount, fmt, operator): if int(amount) < 0: raise value_error('amount must b...
class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: banset = set(banned) for c in "!?',;.": paragraph = paragraph.replace(c, ' ') cnt = Counter(word for word in paragraph.lower().split()) ans, best = '', 0 for word in cnt: if cnt[word] > best and word no...
class Solution: def most_common_word(self, paragraph: str, banned: List[str]) -> str: banset = set(banned) for c in "!?',;.": paragraph = paragraph.replace(c, ' ') cnt = counter((word for word in paragraph.lower().split())) (ans, best) = ('', 0) for word in cnt: ...
#program to input a number, if it is not a number generate an error message. while True: try: a = int(input("Input a number: ")) break except ValueError: print("\nThis is not a number. Try again...") print() break
while True: try: a = int(input('Input a number: ')) break except ValueError: print('\nThis is not a number. Try again...') print() break
# Introduction to deep learning with Python # A. Forward propogation # Process of working from the input layer to the hidden layer to the final output layer # Values contained within the input layer are multiplied by the weights that are connected to the interactions for the hidden layer. # Details contained within th...
node_0_value = (input_data * weights['node_0']).sum() node_1_value = (input_data * weights['node_1']).sum() hidden_layer_outputs = np.array([node_0_value, node_1_value]) output = (hidden_layer_outputs * weights['output']).sum() print(output) def relu(input): """Define your relu activation function here""" outp...
class Destiny2APIError(Exception): pass class Destiny2InvalidParameters(Destiny2APIError): pass class Destiny2APICooldown(Destiny2APIError): pass class Destiny2RefreshTokenError(Destiny2APIError): pass class Destiny2MissingAPITokens(Destiny2APIError): pass class Destiny2MissingManifest(Des...
class Destiny2Apierror(Exception): pass class Destiny2Invalidparameters(Destiny2APIError): pass class Destiny2Apicooldown(Destiny2APIError): pass class Destiny2Refreshtokenerror(Destiny2APIError): pass class Destiny2Missingapitokens(Destiny2APIError): pass class Destiny2Missingmanifest(Destiny2...
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: dic = {} for i, num in enumerate(numbers): if target - num in dic: return [dic[target - num] + 1, i + 1] dic[num] = i
class Solution: def two_sum(self, numbers: List[int], target: int) -> List[int]: dic = {} for (i, num) in enumerate(numbers): if target - num in dic: return [dic[target - num] + 1, i + 1] dic[num] = i
# OpenWeatherMap API Key weather_api_key = "601b4c14f4ddb46a0080bbfb5ca51d3e" # Google API Key g_key = "AIzaSyDNUFB01N6sBwZfPznGBiHayHJrON12pYw"
weather_api_key = '601b4c14f4ddb46a0080bbfb5ca51d3e' g_key = 'AIzaSyDNUFB01N6sBwZfPznGBiHayHJrON12pYw'
class BaseModel: def __init__(self): self.ops = {}
class Basemodel: def __init__(self): self.ops = {}
# user.py __all__ = ['User'] class User: pass def user_helper_1(): pass
__all__ = ['User'] class User: pass def user_helper_1(): pass
description = 'IPC Motor bus device configuration' group = 'lowlevel' instrument_values = configdata('instrument.values') tango_base = instrument_values['tango_base'] # data from instrument.inf # used for: # - shutter_gamma (addr 0x31) # - nok2 (addr 0x32, 0x33) # - nok3 (addr 0x34, 0x35) # - nok4 reactor side (add...
description = 'IPC Motor bus device configuration' group = 'lowlevel' instrument_values = configdata('instrument.values') tango_base = instrument_values['tango_base'] devices = dict(nokbus1=device('nicos.devices.vendor.ipc.IPCModBusTango', tangodevice=tango_base + 'test/ipcsms_a/bio', lowlevel=True))
def extractMichilunWordpressCom(item): ''' Parser for 'michilun.wordpress.com' ''' bad = [ 'Recommendations and Reviews', ] if any([tmp in item['tags'] for tmp in bad]): return None vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title...
def extract_michilun_wordpress_com(item): """ Parser for 'michilun.wordpress.com' """ bad = ['Recommendations and Reviews'] if any([tmp in item['tags'] for tmp in bad]): return None (vol, chp, frag, postfix) = extract_vol_chapter_fragment_postfix(item['title']) if not (chp or vol) or 'prev...
def main(): with open('inputs/01.in') as f: data = [int(line) for line in f] print(sum(data)) result = 0 seen = {0} while True: for item in data: result += item if result in seen: print(result) return seen.add(resu...
def main(): with open('inputs/01.in') as f: data = [int(line) for line in f] print(sum(data)) result = 0 seen = {0} while True: for item in data: result += item if result in seen: print(result) return seen.add(result...
strikeout = 'K' className = "This is CS50." age = 30 anotherAge = 63 pi = 3.14 morePi = 3.1415962 fun = True print("strikeout: {}".format(strikeout)) print("className: {}".format(className)) print("age: {}".format(age)) print("anotherAge: {}".format(anotherAge)) print("pi: {}".format(pi)) print("morePi: {}".format(mor...
strikeout = 'K' class_name = 'This is CS50.' age = 30 another_age = 63 pi = 3.14 more_pi = 3.1415962 fun = True print('strikeout: {}'.format(strikeout)) print('className: {}'.format(className)) print('age: {}'.format(age)) print('anotherAge: {}'.format(anotherAge)) print('pi: {}'.format(pi)) print('morePi: {}'.format(m...
def is_all_strings(iterable): return all(isinstance(string, str) for string in iterable) print(['a', 'b', 'c']) print([2, 'a', 'b', 'c'])
def is_all_strings(iterable): return all((isinstance(string, str) for string in iterable)) print(['a', 'b', 'c']) print([2, 'a', 'b', 'c'])
def concat_multiples(num, multiples): return int("".join([str(num*multiple) for multiple in range(1,multiples+1)])) def is_pandigital(num): return sorted([int(digit) for digit in str(num)]) == list(range(1,10)) def solve_p038(): # retrieve only 9 digit concatinations of multiples where n = (1,2,..n) ...
def concat_multiples(num, multiples): return int(''.join([str(num * multiple) for multiple in range(1, multiples + 1)])) def is_pandigital(num): return sorted([int(digit) for digit in str(num)]) == list(range(1, 10)) def solve_p038(): n6 = [concat_multiples(num, 6) for num in [3]] n5 = [concat_multipl...
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, }, 'targets': [ { # GN version: //ui/aura_extra 'target_name': 'aura_extra', 'type': '<(...
{'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'aura_extra', 'type': '<(component)', 'dependencies': ['../../base/base.gyp:base', '../../skia/skia.gyp:skia', '../aura/aura.gyp:aura', '../base/ui_base.gyp:ui_base', '../events/events.gyp:events', '../gfx/gfx.gyp:gfx', '../gfx/gfx.gyp:gfx_geometry'], 'def...
class Env: __table = None _prev = None def __init__(self, n): self.__table = {} self._prev = n def put(self, w, i): self.__table[w] = i def get(self, w): e = self while e is not None: found = e.__table.get(w) if found is not None: ...
class Env: __table = None _prev = None def __init__(self, n): self.__table = {} self._prev = n def put(self, w, i): self.__table[w] = i def get(self, w): e = self while e is not None: found = e.__table.get(w) if found is not None: ...
def foo(*args, **kwargs): pass fo<caret>o(1, 2, 3, x = 4)
def foo(*args, **kwargs): pass fo < caret > o(1, 2, 3, x=4)
#!/usr/bin/python3 # -*- coding: utf-8 -*- # # 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 ...
__all__ = ['logging', 'lang', 'data', 'utils'] __name__ = 'bbutils' __author__ = 'Kai Raphahn' __email__ = 'kai.raphahn@laburec.de' __year__ = 2020 __copyright__ = 'Copyright (C) {0:d}, {1:s} <{2:s}>'.format(__year__, __author__, __email__) __description__ = 'Small collection of stuff for all my other python projects (...
class physics:#universal physics(excluding projectiles because i hate them) def __init__(self,world,gravity = 2): self.gravity = gravity self.world = world def isAtScreenBottom(self,obj):#unused if obj.y + obj.size[1] <= screenSize[1]: return True else: ...
class Physics: def __init__(self, world, gravity=2): self.gravity = gravity self.world = world def is_at_screen_bottom(self, obj): if obj.y + obj.size[1] <= screenSize[1]: return True else: return False def colliding(self, xy1, size1, xy2, size2): ...
class DoublyNode: def __init__(self, data): self.data = data self.leftlink = None self.rightlink = None def __str__(self): return '| {0} |'.format(self.data) def __repr__(self): return "Node('{0}')".format(self.data) def getdata(self): return self.data...
class Doublynode: def __init__(self, data): self.data = data self.leftlink = None self.rightlink = None def __str__(self): return '| {0} |'.format(self.data) def __repr__(self): return "Node('{0}')".format(self.data) def getdata(self): return self.data...
{ 'variables': { 'SMRF_LIB_DIR': '/usr/local/lib', 'SMRF_INCLUDE_DIR': '/usr/local/include' }, 'targets': [ { 'target_name': 'smrf-native-cpp', 'sources': [ 'src/smrf.cpp' ], 'cflags_cc': [ '-std=c++14' ], 'cflags!': [ '-fno-exceptions'], 'cflags_cc!': [ '-fno-exceptions'], 'incl...
{'variables': {'SMRF_LIB_DIR': '/usr/local/lib', 'SMRF_INCLUDE_DIR': '/usr/local/include'}, 'targets': [{'target_name': 'smrf-native-cpp', 'sources': ['src/smrf.cpp'], 'cflags_cc': ['-std=c++14'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'include_dirs': ['<!(node -e "require(\'nan\')")', '<@(S...
# Definition for a undirected graph node # class UndirectedGraphNode: # def __init__(self, x): # self.label = x # self.neighbors = [] class Solution: # @param node, a undirected graph node # @return a undirected graph node def cloneGraph(self, node): root = UndirectedG...
class Solution: def clone_graph(self, node): root = undirected_graph_node(node.label) node.clone = root stack = [(root, x) for x in node.neighbors] while stack: (connectee, node) = stack.pop() if hasattr(node, 'clone'): connectee.neighbors.app...
#!/usr/bin/env python # encoding: utf-8 # This file is made available under Elastic License 2.0 # This file is based on code available under the Apache license here: # https://github.com/apache/incubator-doris/blob/master/gensrc/script/doris_builtins_functions.py # Licensed to the Apache Software Foundation (ASF) u...
visible_functions = [[['bitand'], 'TINYINT', ['TINYINT', 'TINYINT'], '_ZN9starrocks9Operators32bitand_tiny_int_val_tiny_int_valEPN13starrocks_udf15FunctionContextERKNS1_10TinyIntValES6_'], [['bitand'], 'SMALLINT', ['SMALLINT', 'SMALLINT'], '_ZN9starrocks9Operators34bitand_small_int_val_small_int_valEPN13starrocks_udf15...
def test_get_empty_collection(client): empty_response = client.get('/data') assert empty_response.status_code == 200 assert 'json' in empty_response.content_type assert empty_response.is_json assert empty_response.json['href'].startswith('http') assert empty_response.json['href'].endswith('/data...
def test_get_empty_collection(client): empty_response = client.get('/data') assert empty_response.status_code == 200 assert 'json' in empty_response.content_type assert empty_response.is_json assert empty_response.json['href'].startswith('http') assert empty_response.json['href'].endswith('/data...
#!/usr/bin/env python3 def next_nums(): A = 703 B = 516 for _ in range(40000000): A *= 16807 A %= 2147483647 B *= 48271 B %= 2147483647 yield (A, B) count = 0 for newA, newB in next_nums(): if newA % 65536 == newB % 65536: count += 1 print(count)
def next_nums(): a = 703 b = 516 for _ in range(40000000): a *= 16807 a %= 2147483647 b *= 48271 b %= 2147483647 yield (A, B) count = 0 for (new_a, new_b) in next_nums(): if newA % 65536 == newB % 65536: count += 1 print(count)
class ApiConfig: def __init__(self, environment: str = None, name: str = None, is_debug: bool = None, port: int = None, root_directory: str = None): self.port = port self.is_debug = is_debug self.name = name...
class Apiconfig: def __init__(self, environment: str=None, name: str=None, is_debug: bool=None, port: int=None, root_directory: str=None): self.port = port self.is_debug = is_debug self.name = name self.environment = environment self.root_directory = root_directory
data = ( 'Mang ', # 0x00 'Zhu ', # 0x01 'Utsubo ', # 0x02 'Du ', # 0x03 'Ji ', # 0x04 'Xiao ', # 0x05 'Ba ', # 0x06 'Suan ', # 0x07 'Ji ', # 0x08 'Zhen ', # 0x09 'Zhao ', # 0x0a 'Sun ', # 0x0b 'Ya ', # 0x0c 'Zhui ', # 0x0d 'Yuan ', # 0x0e 'Hu ', # 0x0f 'Gang ', # 0x10 ...
data = ('Mang ', 'Zhu ', 'Utsubo ', 'Du ', 'Ji ', 'Xiao ', 'Ba ', 'Suan ', 'Ji ', 'Zhen ', 'Zhao ', 'Sun ', 'Ya ', 'Zhui ', 'Yuan ', 'Hu ', 'Gang ', 'Xiao ', 'Cen ', 'Pi ', 'Bi ', 'Jian ', 'Yi ', 'Dong ', 'Shan ', 'Sheng ', 'Xia ', 'Di ', 'Zhu ', 'Na ', 'Chi ', 'Gu ', 'Li ', 'Qie ', 'Min ', 'Bao ', 'Tiao ', 'Si ', 'Fu ...
# Python 3.6.1 with open("input.txt", "r") as f: puzzle_input = [int(i) for i in f.read()[0:-1]] total = 0 for cur_index in range(len(puzzle_input)): next_index = cur_index + 1 if not cur_index == len(puzzle_input) - 1 else 0 puz_cur = puzzle_input[cur_index] pnext = puzzle_input[next_index] if p...
with open('input.txt', 'r') as f: puzzle_input = [int(i) for i in f.read()[0:-1]] total = 0 for cur_index in range(len(puzzle_input)): next_index = cur_index + 1 if not cur_index == len(puzzle_input) - 1 else 0 puz_cur = puzzle_input[cur_index] pnext = puzzle_input[next_index] if puz_cur == pnext: ...
s = input() y = int(input()) n = int(input()) c = 0 for i in s: if int(i) <= y: c += 1 for i in range(n): for j in range(2, n-1): if int(s[i:j+i]) <= y: c += 1 print(c) ''' qx = [i for i in range(input1)] for i, j in input3: if i == 1: qx = qx[1:] i...
s = input() y = int(input()) n = int(input()) c = 0 for i in s: if int(i) <= y: c += 1 for i in range(n): for j in range(2, n - 1): if int(s[i:j + i]) <= y: c += 1 print(c) '\nqx = [i for i in range(input1)]\nfor i, j in input3:\n if i == 1:\n qx = qx[1:]\n if i == 2:\n ...
def is_balanced(s): pairs = {"(": ")", "[": "]", "{": "}"} stack = [] for ch in s: if ch in pairs: stack.append(ch) else: if len(stack) == 0: return False if pairs[stack.pop()] != ch: return False return len(stack) == ...
def is_balanced(s): pairs = {'(': ')', '[': ']', '{': '}'} stack = [] for ch in s: if ch in pairs: stack.append(ch) else: if len(stack) == 0: return False if pairs[stack.pop()] != ch: return False return len(stack) == 0
def generate(label): ( bbox_xmin, bbox_ymin, bbox_xmax, bbox_ymax, img_width, img_height ) = ( label.get('xmin'), label.get('ymin'), label.get('xmax'), label.get('ymax'), label.get('img_width'), label.get('img_height...
def generate(label): (bbox_xmin, bbox_ymin, bbox_xmax, bbox_ymax, img_width, img_height) = (label.get('xmin'), label.get('ymin'), label.get('xmax'), label.get('ymax'), label.get('img_width'), label.get('img_height')) dw = 1.0 / img_width dh = 1.0 / img_height x = (bbox_xmin + bbox_xmax) / 2.0 y = (b...
print("hello") count=1 if count<1: print("yes") else: print("no")
print('hello') count = 1 if count < 1: print('yes') else: print('no')
# functions print("Demonstrating functions....") def fun(): print("Printing my function: fun") def fun1(): print("Printing my function: fun1") def multiply(x, y): z = x * y return z mulnum = multiply(150, 160) print(f"The return value is {mulnum}") # Demonstrating lambda functions # Lambda functi...
print('Demonstrating functions....') def fun(): print('Printing my function: fun') def fun1(): print('Printing my function: fun1') def multiply(x, y): z = x * y return z mulnum = multiply(150, 160) print(f'The return value is {mulnum}') x = lambda a: a + 10 print(f'The value of x is {x}') y = x(5) pr...
class MCP3008(): def __init__(self, channel): self.fake_val = 0 def value(self, pin=None): return self.fake_val
class Mcp3008: def __init__(self, channel): self.fake_val = 0 def value(self, pin=None): return self.fake_val
firt_tuple = (5,5,4,6,1,2,3) new_list = list(firt_tuple) new_tuple = tuple(new_list) print(len(firt_tuple)) print(max(new_list)) print(min(new_tuple))
firt_tuple = (5, 5, 4, 6, 1, 2, 3) new_list = list(firt_tuple) new_tuple = tuple(new_list) print(len(firt_tuple)) print(max(new_list)) print(min(new_tuple))
# Please note that if you uncomment and press multiple times, the program will keep appending to the file. def cap_four(name): new_name = name[0].upper() + name[1:3] + name[3].upper() + name[4:] return new_name # Check answer = cap_four('macdonald') print(answer)
def cap_four(name): new_name = name[0].upper() + name[1:3] + name[3].upper() + name[4:] return new_name answer = cap_four('macdonald') print(answer)
class Solution: def isPalindrome(self, s: str) -> bool: s=s.lower() s=[x for x in s if x.isalnum() ] return s==s[::-1]
class Solution: def is_palindrome(self, s: str) -> bool: s = s.lower() s = [x for x in s if x.isalnum()] return s == s[::-1]
if _: l = 2 else: l = []
if _: l = 2 else: l = []
MONTHS = { 'january': 1, 'february': 2, 'march': 3, 'april': 4, 'may': 5, 'june': 6, 'july': 7, 'august': 8, 'september': 9, 'october': 10, 'november': 11, 'december': 12, } SHORT_MONTH = [ '', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep...
months = {'january': 1, 'february': 2, 'march': 3, 'april': 4, 'may': 5, 'june': 6, 'july': 7, 'august': 8, 'september': 9, 'october': 10, 'november': 11, 'december': 12} short_month = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
# Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'subdir_file', 'type': 'none', 'msvs_cygwin_shell': 0, 'actions': [ { '...
{'targets': [{'target_name': 'subdir_file', 'type': 'none', 'msvs_cygwin_shell': 0, 'actions': [{'action_name': 'make-subdir-file', 'inputs': ['make-subdir-file.py'], 'outputs': ['<(PRODUCT_DIR)/subdir_file.out'], 'action': ['python', '<(_inputs)', '<@(_outputs)'], 'process_outputs_as_sources': 1}]}]}
# nCk n, m = map(int, input().split(' ')) # numerator numerator = 1 for i in range(0, m): numerator *= n n -= 1 # denominator denominator = 1 for i in range(m, 0, -1): denominator *= i print(numerator // denominator)
(n, m) = map(int, input().split(' ')) numerator = 1 for i in range(0, m): numerator *= n n -= 1 denominator = 1 for i in range(m, 0, -1): denominator *= i print(numerator // denominator)
''' Problem Statement: ----------------- Given an array A of size N of integers. Your task is to find the minimum and maximum elements in the array. Example 1: --------- Input: N = 6 A[] = {3, 2, 1, 56, 10000, 167} Output: min = 1, max = 10000 Example 2: ---------- Input: N = 5 A[] = {1, 345, 234, 21, 56789} Output: ...
""" Problem Statement: ----------------- Given an array A of size N of integers. Your task is to find the minimum and maximum elements in the array. Example 1: --------- Input: N = 6 A[] = {3, 2, 1, 56, 10000, 167} Output: min = 1, max = 10000 Example 2: ---------- Input: N = 5 A[] = {1, 345, 234, 21, 56789} Output: ...
class Enum(object): def __init__(self, plugin, node): if node.tag != 'enum': raise ValueError('expected <enum>, got <%s>' % node.tag) self.plugin = plugin self.name = node.attrib['name'] self.item_prefix = node.attrib.get('item-prefix', '') self.base = int(node.at...
class Enum(object): def __init__(self, plugin, node): if node.tag != 'enum': raise value_error('expected <enum>, got <%s>' % node.tag) self.plugin = plugin self.name = node.attrib['name'] self.item_prefix = node.attrib.get('item-prefix', '') self.base = int(node....
connChoices = ( {'name': 'automatic', 'rate': {'min': 0, 'max': 5000, 'def': 0}, 'conn': {'min': 0, 'max': 100, 'def': 0}, 'automatic': 1}, {'name': 'unlimited', 'rate': {'min': 0, 'max': 5000, 'def': 0, 'div': 50}, 'conn': {'min': 4, 'max': 100, 'def': 4}}, {'name': 'dialup/isdn'...
conn_choices = ({'name': 'automatic', 'rate': {'min': 0, 'max': 5000, 'def': 0}, 'conn': {'min': 0, 'max': 100, 'def': 0}, 'automatic': 1}, {'name': 'unlimited', 'rate': {'min': 0, 'max': 5000, 'def': 0, 'div': 50}, 'conn': {'min': 4, 'max': 100, 'def': 4}}, {'name': 'dialup/isdn', 'rate': {'min': 3, 'max': 8, 'def': 5...
# # PySNMP MIB module HUAWEI-MA5200-DEVICE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-MA5200-DEVICE-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:46:33 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_size_constraint, constraints_union, value_range_constraint) ...
BOT_NAME = 'podcast_scraper' SPIDER_MODULES = ['podcast_scraper.spiders'] NEWSPIDER_MODULE = 'podcast_scraper.spiders' SCHEDULER_DEBUG = 'True' LOG_LEVEL = 'DEBUG' # LOG_FILE = './logs/log.txt' # app.py will use OUTPUT_BUCKET to generate an OUTPUT_URI # using OUTPUT_BUCKET and spider_name. OUTPUT_BUCKET = 'output-rs...
bot_name = 'podcast_scraper' spider_modules = ['podcast_scraper.spiders'] newspider_module = 'podcast_scraper.spiders' scheduler_debug = 'True' log_level = 'DEBUG' output_bucket = 'output-rss-bucket-name' item_pipelines = {'scrapy_podcast_rss.pipelines.PodcastPipeline': 300}
def fib(n_max): n, a, b = 0, 0, 1 while n < n_max: yield b a, b = b, a + b n = n + 1 list = fib(int(input("Input a number:"))) print(next(list)) for o in list: print(o)
def fib(n_max): (n, a, b) = (0, 0, 1) while n < n_max: yield b (a, b) = (b, a + b) n = n + 1 list = fib(int(input('Input a number:'))) print(next(list)) for o in list: print(o)
def mostFrequentDigitSum(n): ''' A step(x) operation works like this: it changes a number x into x - s(x), where s(x) is the sum of x's digits. You like applying functions to numbers, so given the number n, you decide to build a decreasing sequence of numbers: n, step(n), step(step(n)), etc., with 0 as the last...
def most_frequent_digit_sum(n): """ A step(x) operation works like this: it changes a number x into x - s(x), where s(x) is the sum of x's digits. You like applying functions to numbers, so given the number n, you decide to build a decreasing sequence of numbers: n, step(n), step(step(n)), etc., with 0 as the l...
# x=int(input("enter the number")) # print("factors of ",x,"is:") # for i in range (1,x+1): # if X%i==0: # print(i) n=int(input("enter factors number=")) i=1 while i<=n: if n%i==0: print(i) i+=1
n = int(input('enter factors number=')) i = 1 while i <= n: if n % i == 0: print(i) i += 1
''' Created on Feb 20, 2013 @author: gorgolewski, steele ''' #import os #subjects = os.listdir("/scr/namibia1/baird/MPI_Project/Neuroimaging_Data/") working_dir = "/scr/alaska1/steele/BSL_IHI/processing/cmt" results_dir = "/scr/alaska1/steele/BSL_IHI/processing/cmt/results" freesurfer_dir = '/scr/alaska1/steele/BSL_I...
""" Created on Feb 20, 2013 @author: gorgolewski, steele """ working_dir = '/scr/alaska1/steele/BSL_IHI/processing/cmt' results_dir = '/scr/alaska1/steele/BSL_IHI/processing/cmt/results' freesurfer_dir = '/scr/alaska1/steele/BSL_IHI/processing/freesurfer/' subjects_m = ['KCDT100819_T1.TRIO', 'JA7T100824_T1.TRIO', '172...
def szyfr(ciag, k): nowy_ciag = "" for lit in ciag: nowy_ord = 65+(ord(lit)-65+k) % 26 nowy_ciag += chr(nowy_ord) return nowy_ciag def odszyfr(ciag, k): nowy_ciag = "" for lit in ciag: nowy_ord = 65+(ord(lit)-65-k) % 26 nowy_ciag += chr(nowy_ord) return nowy_cia...
def szyfr(ciag, k): nowy_ciag = '' for lit in ciag: nowy_ord = 65 + (ord(lit) - 65 + k) % 26 nowy_ciag += chr(nowy_ord) return nowy_ciag def odszyfr(ciag, k): nowy_ciag = '' for lit in ciag: nowy_ord = 65 + (ord(lit) - 65 - k) % 26 nowy_ciag += chr(nowy_ord) retu...
#!/usr/bin/python patch_size = [11, 15, 21] detector = ["FeatureDetectorHarrisCV", "FeatureDetectorUniform"] filter_size = [1, 3] max_disparity = [140, 160, 180, 200] fp_runscript = open("/mnt/ssd/kivan/cv-stereo/scripts/eval_batch/run_batch_grid_search_stage2.sh", 'w') fp_runscript.write("#!/bin/bash\n\n") cnt = 0 ...
patch_size = [11, 15, 21] detector = ['FeatureDetectorHarrisCV', 'FeatureDetectorUniform'] filter_size = [1, 3] max_disparity = [140, 160, 180, 200] fp_runscript = open('/mnt/ssd/kivan/cv-stereo/scripts/eval_batch/run_batch_grid_search_stage2.sh', 'w') fp_runscript.write('#!/bin/bash\n\n') cnt = 0 for i in range(len(pa...
# 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 isMirror(self, r1: TreeNode, r2: TreeNode) -> bool: if r1 == None and r2 == None: re...
class Solution: def is_mirror(self, r1: TreeNode, r2: TreeNode) -> bool: if r1 == None and r2 == None: return True if r1 == None or r2 == None: return False return r1.val == r2.val and self.isMirror(r1.left, r2.right) and self.isMirror(r1.right, r2.left) def is_...
class Passenger: def __init__(self, name): self.name = name def selectTrip(self, tripOptions): ''' Given a list of trip options, a passenger may select a trip This trip is then added to the trip queue, which allows for later return pricing tripOptions: the queue of give...
class Passenger: def __init__(self, name): self.name = name def select_trip(self, tripOptions): """ Given a list of trip options, a passenger may select a trip This trip is then added to the trip queue, which allows for later return pricing tripOptions: the queue of gi...
# A file containing mappings of CC -> MC file names # Pack version 3 VER3 = { 'char.png': 'minecraft/textures/entity/steve.png', 'chicken.png': 'minecraft/textures/entity/chicken.png', 'creeper.png': 'minecraft/textures/entity/creeper/creeper.png', 'pig.png': 'minecraft/textures/entity/pig/pig.png', ...
ver3 = {'char.png': 'minecraft/textures/entity/steve.png', 'chicken.png': 'minecraft/textures/entity/chicken.png', 'creeper.png': 'minecraft/textures/entity/creeper/creeper.png', 'pig.png': 'minecraft/textures/entity/pig/pig.png', 'sheep.png': 'minecraft/textures/entity/sheep/sheep.png', 'sheep_fur.png': 'minecraft/tex...
# output: ok assert(max(1, 2, 3) == 3) assert(max(1, 3, 2) == 3) assert(max(3, 2, 1) == 3) assert(min([1]) == 1) assert(min([1, 2, 3]) == 1) assert(min([1, 3, 2]) == 1) assert(min([3, 2, 1]) == 1) exception = False try: min() except TypeError: exception = True assert(exception) exception = False try: max...
assert max(1, 2, 3) == 3 assert max(1, 3, 2) == 3 assert max(3, 2, 1) == 3 assert min([1]) == 1 assert min([1, 2, 3]) == 1 assert min([1, 3, 2]) == 1 assert min([3, 2, 1]) == 1 exception = False try: min() except TypeError: exception = True assert exception exception = False try: max() except TypeError: ...
# Hack 1: InfoDB lists. Build your own/personalized InfoDb with a list length > 3, create list within a list as illustrated with Owns_Cars blue = "\033[34m" white = "\033[37m" InfoDb = [] # List with dictionary records placed in a list InfoDb.append({ "FirstName": "Michael", "Las...
blue = '\x1b[34m' white = '\x1b[37m' info_db = [] InfoDb.append({'FirstName': 'Michael', 'LastName': 'Chen', 'DOB': 'December 1', 'Residence': 'San Diego', 'Email': 'michaelc57247@stu.powayusd.com', 'Owns_Cars': ['2016 Ford Focus EV', '2019 Honda Pilot']}) InfoDb.append({'FirstName': 'Ethan', 'LastName': 'Vo', 'DOB': '...
x,y,z = map(int,input().split(' ')) a,b,c = map(int,input().split(' ')) if (x, y, z) == (a, b, c): print("0") elif (y, z) == (b, c): print(15 * (x - a)) elif z==c: if y<=b and x<=a: print("0") else: print(500 * (y - b)) elif z>c: print("10000") else: print("0")
(x, y, z) = map(int, input().split(' ')) (a, b, c) = map(int, input().split(' ')) if (x, y, z) == (a, b, c): print('0') elif (y, z) == (b, c): print(15 * (x - a)) elif z == c: if y <= b and x <= a: print('0') else: print(500 * (y - b)) elif z > c: print('10000') else: print('0')
def get_sum(arr,i,j): sum = 0 sum += arr[i-1][j-1] sum += arr[i-1][j] sum += arr[i - 1][j+1] sum += arr[i][j] sum += arr[i+1][j-1] sum += arr[i+1][j] sum += arr[i+1][j+1] return sum if __name__ == '__main__': arr = [] for _ in range(6): arr.append(list(map(int, inp...
def get_sum(arr, i, j): sum = 0 sum += arr[i - 1][j - 1] sum += arr[i - 1][j] sum += arr[i - 1][j + 1] sum += arr[i][j] sum += arr[i + 1][j - 1] sum += arr[i + 1][j] sum += arr[i + 1][j + 1] return sum if __name__ == '__main__': arr = [] for _ in range(6): arr.append(...