content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
print("BMI CALCULATER") def BMICal(weight,height): try: bim = 0 height = float(height)/100 bim = float(weight)/(height**2) print("BMI is {:.2f}.".format(bim)) except Exception: print("Sorry!, something went wrong") BMICal(65,180)
print('BMI CALCULATER') def bmi_cal(weight, height): try: bim = 0 height = float(height) / 100 bim = float(weight) / height ** 2 print('BMI is {:.2f}.'.format(bim)) except Exception: print('Sorry!, something went wrong') bmi_cal(65, 180)
# https://www.codewars.com/kata/simple-events/train/python # My solution class Event(): handlers = set() def subscribe(self, function): self.handlers.add(function) def unsubscribe(self, function): self.handlers.remove(function) def emit(self, *args, **kargs)...
class Event: handlers = set() def subscribe(self, function): self.handlers.add(function) def unsubscribe(self, function): self.handlers.remove(function) def emit(self, *args, **kargs): for f in self.handlers: f(*args, **kargs)
rotors = [] rotors.append(['E','K','M','F','L','G','D','Q','V','Z','N','T','O','W','Y','H','X','U','S','P','A','I','B','R','C','J']) # Rotor I rotors.append(['A','J','D','K','S','I','R','U','X','B','L','H','W','T','M','C','Q','G','Z','N','P','Y','F','V','O','E']) # Rotor II rotors.append(['B','D','F','H','J','L','C','P...
rotors = [] rotors.append(['E', 'K', 'M', 'F', 'L', 'G', 'D', 'Q', 'V', 'Z', 'N', 'T', 'O', 'W', 'Y', 'H', 'X', 'U', 'S', 'P', 'A', 'I', 'B', 'R', 'C', 'J']) rotors.append(['A', 'J', 'D', 'K', 'S', 'I', 'R', 'U', 'X', 'B', 'L', 'H', 'W', 'T', 'M', 'C', 'Q', 'G', 'Z', 'N', 'P', 'Y', 'F', 'V', 'O', 'E']) rotors.append(['...
pkgname = "fonts-dejavu-otf" pkgver = "2.37" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" make_build_target = "full-otf" make_build_args = ["full-ttf"] hostmakedepends = ["gmake", "fontforge-cli", "perl-font-ttf"] depends = ["fonts-dejavu-common"] provides = [f"fonts-dejavu={pkgver}-r{pkgrel}"] provider_prior...
pkgname = 'fonts-dejavu-otf' pkgver = '2.37' pkgrel = 0 build_style = 'makefile' make_cmd = 'gmake' make_build_target = 'full-otf' make_build_args = ['full-ttf'] hostmakedepends = ['gmake', 'fontforge-cli', 'perl-font-ttf'] depends = ['fonts-dejavu-common'] provides = [f'fonts-dejavu={pkgver}-r{pkgrel}'] provider_prior...
''' The numbers n1 and n2 have the property P if their writings in basis 10 have the same digits (e.g. 2113 and 323121). Determine whether two given natural numbers have the property P ''' def readNaturalNumber(message): ''' in: message - string -> the message shown before reading the number ...
""" The numbers n1 and n2 have the property P if their writings in basis 10 have the same digits (e.g. 2113 and 323121). Determine whether two given natural numbers have the property P """ def read_natural_number(message): """ in: message - string -> the message shown before reading the number out:...
# method 1 arr = [1,2,3,4,5,6] arr1 = [] for i in range(0, len(arr)): arr1.append(arr[i]) print(arr1) # method 2 arr2 = [4,6,7,8,9] arr3 = arr2 print(arr3) # method 3 arr4 = [9,7,6,5,4,3] arr5 = arr4.copy() print(arr5)
arr = [1, 2, 3, 4, 5, 6] arr1 = [] for i in range(0, len(arr)): arr1.append(arr[i]) print(arr1) arr2 = [4, 6, 7, 8, 9] arr3 = arr2 print(arr3) arr4 = [9, 7, 6, 5, 4, 3] arr5 = arr4.copy() print(arr5)
class meeting: def __init__(self, start, end, pos): self.start = start self.end = end self.pos = pos def __lt__(self, other): return self.end < other.end def __str__(self): return f"{self.end} - {self.start}" class maxMeeting: def __init__(self, ...
class Meeting: def __init__(self, start, end, pos): self.start = start self.end = end self.pos = pos def __lt__(self, other): return self.end < other.end def __str__(self): return f'{self.end} - {self.start}' class Maxmeeting: def __init__(self, first, last, ...
# time complexity: O(n) # space complexity: O(1) # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy_head = ListNode(-1) curr_poi...
class Solution: def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode: dummy_head = list_node(-1) curr_pointer = dummy_head p1 = l1 p2 = l2 while p1 is not None and p2 is not None: if p1.val <= p2.val: curr_pointer.next = p1 ...
RNATable = { 'UUU':'F', 'CUU':'L', 'AUU':'I', 'GUU':'V', 'UUC':'F', 'UUA':'L', 'UUG':'L', 'UCU':'S', 'UCC':'S', 'CUC':'L', 'AUC':'I', 'GUC':'V', 'CUA':'L', 'AUA':'I', 'AUG':'M', 'GUG':'V', 'CCU':'P', 'ACU':'T', 'GCU':'A', 'CCC':'P', 'ACC':'T', 'GCC':'A', 'UCA':'S', 'CCA':'P', ...
rna_table = {'UUU': 'F', 'CUU': 'L', 'AUU': 'I', 'GUU': 'V', 'UUC': 'F', 'UUA': 'L', 'UUG': 'L', 'UCU': 'S', 'UCC': 'S', 'CUC': 'L', 'AUC': 'I', 'GUC': 'V', 'CUA': 'L', 'AUA': 'I', 'AUG': 'M', 'GUG': 'V', 'CCU': 'P', 'ACU': 'T', 'GCU': 'A', 'CCC': 'P', 'ACC': 'T', 'GCC': 'A', 'UCA': 'S', 'CCA': 'P', 'ACA': 'T', 'GCA': ...
# normalized vocabulary for evidence_label # 'FDA guidelines', 'preclinical', 'trials', 'NCCN guidelines', or # 'European LeukemiaNet Guidelines' # see https://docs.google.com/spreadsheets/d/1j9AKdv1k87iO8qH-ujnW3x4VusbGoXDjdb5apUqJsSI/edit#gid=1415903760 def evidence_label(evidence, association, na=False): # ...
def evidence_label(evidence, association, na=False): cgi_a = ['cpic guidelines', 'european leukemianet guidelines', 'fda guidelines', 'nccn guidelines', 'nccn/cap guidelines'] cgi_b = ['late trials', 'late trials,pre-clinical'] cgi_c = ['early trials', 'case report', 'clinical trial', 'early trials,case rep...
ppw = 128 # points per wavelength position = ppw/16 thickness = ppw/16 foil = 0.7 PI = 3.14159265358979 ## MISCELLANEOUS def Block(x, xmin, xmax): if x > xmin and x < xmax: return 1 else: return 0 ## GENERAL PARAMETERS MAX_Z = 6*ppw # number of the steps for coordinate MAX_T = 10*ppw+1 # number of the steps...
ppw = 128 position = ppw / 16 thickness = ppw / 16 foil = 0.7 pi = 3.14159265358979 def block(x, xmin, xmax): if x > xmin and x < xmax: return 1 else: return 0 max_z = 6 * ppw max_t = 10 * ppw + 1 dt = 2 * PI / ppw dz = 2 * PI / ppw theta = 0.0 pml = ppw pml_max_sigma = 100.0 num_sp = 3 mass_0 ...
def painting_the_array_i(array): count = 0 last1 = None last2 = None buffer = None buffer_count = 0 for i in array: if last1 is None or (i != last1 and last2 is None): last1 = i count += 1 elif last2 is None: last2 = i count += 1 ...
def painting_the_array_i(array): count = 0 last1 = None last2 = None buffer = None buffer_count = 0 for i in array: if last1 is None or (i != last1 and last2 is None): last1 = i count += 1 elif last2 is None: last2 = i count += 1 ...
HOST="localhost" PORT=8941 WORK_DIR='/python36_test/server/WORK_DIR/' DATA_DIR='/python36_test/server/pypi_python/data' SUBPORT=8950
host = 'localhost' port = 8941 work_dir = '/python36_test/server/WORK_DIR/' data_dir = '/python36_test/server/pypi_python/data' subport = 8950
#!/usr/bin/python3 # -*- coding: UTF-8 -*- inst_rom = open("inst_rom.data", "r") inst_data0 = open("inst_data0.data", "w+") inst_data1 = open("inst_data1.data", "w+") inst_data2 = open("inst_data2.data", "w+") inst_data3 = open("inst_data3.data", "w+") for line in inst_rom: inst_data3.write(str(line[0:2]) + '\n') ...
inst_rom = open('inst_rom.data', 'r') inst_data0 = open('inst_data0.data', 'w+') inst_data1 = open('inst_data1.data', 'w+') inst_data2 = open('inst_data2.data', 'w+') inst_data3 = open('inst_data3.data', 'w+') for line in inst_rom: inst_data3.write(str(line[0:2]) + '\n') inst_data2.write(str(line[2:4]) + '\n') ...
def modify_file_inplace(filename, crypto, blocksize=16): ''' Open `filename` and encrypt/decrypt according to `crypto` :filename: a filename (preferably absolute path) :crypto: a stream cipher function that takes in a plaintext, and returns a ciphertext of identical length :blocksize: ...
def modify_file_inplace(filename, crypto, blocksize=16): """ Open `filename` and encrypt/decrypt according to `crypto` :filename: a filename (preferably absolute path) :crypto: a stream cipher function that takes in a plaintext, and returns a ciphertext of identical length :blocksize: ...
#!/usr/bin/env python3 with open('number-values.mk', 'w') as fp: print('# Auto-generated by generate-number-values.py.', file=fp) for i in range(256): print(f'value_{i} := {" ".join("x" * i)}', file=fp)
with open('number-values.mk', 'w') as fp: print('# Auto-generated by generate-number-values.py.', file=fp) for i in range(256): print(f"value_{i} := {' '.join('x' * i)}", file=fp)
# Write your solution for 1.3 here! s= 0 a = 0 while s < 10000: a +=1 if a%2==0: s += a print(s) print(a)
s = 0 a = 0 while s < 10000: a += 1 if a % 2 == 0: s += a print(s) print(a)
def logging_decorator(fn): def wrapper(*args, **kwargs): print(f"You called {fn.__name__}{args}") result = fn(args[0], args[1], args[2]) print(f"It returned {result}") return wrapper @logging_decorator def multiply_function(a, b, c): return a * b * c multiply_function(2, 3, 4)
def logging_decorator(fn): def wrapper(*args, **kwargs): print(f'You called {fn.__name__}{args}') result = fn(args[0], args[1], args[2]) print(f'It returned {result}') return wrapper @logging_decorator def multiply_function(a, b, c): return a * b * c multiply_function(2, 3, 4)
def compute(): def extract(sudoku): # For example: extract([3, 9, 4, 1, ...]) = 394 return int("".join(map(str, sudoku[ : 3]))) ans = sum(extract(solve(puz)) for puz in PUZZLES) return str(ans) # Given a string of 81 digits, this returns a list of 81 ints representing the solved sudoku puzzle. def solve(puzzl...
def compute(): def extract(sudoku): return int(''.join(map(str, sudoku[:3]))) ans = sum((extract(solve(puz)) for puz in PUZZLES)) return str(ans) def solve(puzzlestr): assert len(puzzlestr) == 81 state = [int(c) for c in puzzlestr] colfree = [set(range(1, 10)) for i in range(9)] ro...
# This problem was recently asked by Amazon: # You are given a 2D array of integers. Print out the clockwise spiral traversal of the matrix. def matrix_spiral_print(M): # Fill this in. ''' k - starting row index l - starting column index i - iterator ''' k = 0 l = 0 m = 4 # n...
def matrix_spiral_print(M): """ k - starting row index l - starting column index i - iterator """ k = 0 l = 0 m = 4 n = 5 while k < m and l < n: for i in range(l, n): print(M[k][i], end=' ') k += 1 for i in range(k, m): print(M[i][n...
# minimal fake urpa used for monkeypatching def condition_factory(): pass class App: pass class Condition: pass class AppElement: pass
def condition_factory(): pass class App: pass class Condition: pass class Appelement: pass
p_1_hats = [] df['income_binary'] = np.where(df['income'] == '<=50k', 0, 1) df['income_dp'] = 0 for j in range(500): values = [] for i, x in enumerate(df['income_binary']): values.append (process_value(x, p, k)) df['income_dp'] = np.array(values) p_1dp = df['income_dp'].sum()/len(df) p_1...
p_1_hats = [] df['income_binary'] = np.where(df['income'] == '<=50k', 0, 1) df['income_dp'] = 0 for j in range(500): values = [] for (i, x) in enumerate(df['income_binary']): values.append(process_value(x, p, k)) df['income_dp'] = np.array(values) p_1dp = df['income_dp'].sum() / len(df) p_1_...
## qutebrowser config.py config.load_autoconfig() c.backend = 'webengine' c.content.pdfjs = True c.statusbar.hide = False c.tabs.show = 'always' c.url.default_page = 'http://web.evanchen.cc/static/browser-homepage.html' c.url.searchengines = { 'DEFAULT' : 'https://duckduckgo.com/?q={}' } c.url.start_pages = c.ur...
config.load_autoconfig() c.backend = 'webengine' c.content.pdfjs = True c.statusbar.hide = False c.tabs.show = 'always' c.url.default_page = 'http://web.evanchen.cc/static/browser-homepage.html' c.url.searchengines = {'DEFAULT': 'https://duckduckgo.com/?q={}'} c.url.start_pages = c.url.default_page c.input.insert_mode....
TBLGEN_ACTIONS = [ "-gen-enum-defs", "-gen-enum-decls", "-gen-llvmir-conversions", "-gen-op-decls", "-gen-op-defs", "-gen-op-doc", "-gen-reference-implementations", "-gen-rewriters", ] def _tblgen_impl(ctx): args = ctx.actions.args() args.add(ctx.attr.action) args.add_all(ct...
tblgen_actions = ['-gen-enum-defs', '-gen-enum-decls', '-gen-llvmir-conversions', '-gen-op-decls', '-gen-op-defs', '-gen-op-doc', '-gen-reference-implementations', '-gen-rewriters'] def _tblgen_impl(ctx): args = ctx.actions.args() args.add(ctx.attr.action) args.add_all(ctx.attr.flags) args.add('-I', ct...
configs = dict( iris=dict( hyper_parameters=dict( learning_rate=0.01, momentum=0.99, num_epoch=3, batch_size=4, anneal_factor=0.1, anneal_milestones=[2000], ), data=dict( indexes_path='data/raw/iris/indexes.p...
configs = dict(iris=dict(hyper_parameters=dict(learning_rate=0.01, momentum=0.99, num_epoch=3, batch_size=4, anneal_factor=0.1, anneal_milestones=[2000]), data=dict(indexes_path='data/raw/iris/indexes.pkl')), mnist=dict(hyper_parameters=dict(learning_rate=0.001, momentum=0.99, nesterov=True, num_epoch=100, batch_size=1...
STAR_WARS_BASE = '/questionnaire/0/star_wars/789/' STAR_WARS_INTRODUCTION = STAR_WARS_BASE + 'introduction' STAR_WARS_BLOCK3 = STAR_WARS_BASE + '14ba4707-321d-441d-8d21-b8367366e766/0/0e41e80a-f45a-2dfd-9fe0-55cc2c7807d0' STAR_WARS_BLOCK2 = STAR_WARS_BASE + '14ba4707-321d-441d-8d21-b8367366e766/0/cd3b74d1-b687-4051-963...
star_wars_base = '/questionnaire/0/star_wars/789/' star_wars_introduction = STAR_WARS_BASE + 'introduction' star_wars_block3 = STAR_WARS_BASE + '14ba4707-321d-441d-8d21-b8367366e766/0/0e41e80a-f45a-2dfd-9fe0-55cc2c7807d0' star_wars_block2 = STAR_WARS_BASE + '14ba4707-321d-441d-8d21-b8367366e766/0/cd3b74d1-b687-4051-963...
#: E711 if res == None: pass #: E711 if res != None: pass #: E711 if None == res: pass #: E711 if None != res: pass #: E711 if res[1] == None: pass #: E711 if res[1] != None: pass #: E711 if None != res[1]: pass #: E711 if None == res[1]: pass # #: E712 if res == True: pass #: E712 ...
if res == None: pass if res != None: pass if None == res: pass if None != res: pass if res[1] == None: pass if res[1] != None: pass if None != res[1]: pass if None == res[1]: pass if res == True: pass if res != False: pass if True != res: pass if False == res: pass if res...
def find_all_paths(graph, start, end, costs, path=[]): path = path + [start] if start == end: return [path] if start not in graph: return [] paths = [] for node in graph[start]: if costs[node] != 0: costs[node] -= 1 ...
def find_all_paths(graph, start, end, costs, path=[]): path = path + [start] if start == end: return [path] if start not in graph: return [] paths = [] for node in graph[start]: if costs[node] != 0: costs[node] -= 1 newpaths = find_all_paths(graph, nod...
# # WAP accept a word and display the word in reverse order word = input("Enter word: ") for i in range(0, len(word)): print(word[len(word)-1-i], end='') # # WAP accept a word and count no. of vowel in that word and display. word = input("Enter word: ").lower() count = 0 for i in word: if(i == 'a' or i == 'e' ...
word = input('Enter word: ') for i in range(0, len(word)): print(word[len(word) - 1 - i], end='') word = input('Enter word: ').lower() count = 0 for i in word: if i == 'a' or i == 'e' or i == 'i' or (i == 'o') or (i == 'u'): count += 1 print('The Vowels are: ', i) print('Total vowels: ', count) ...
my_board = [ [7,8,0,4,0,0,1,2,0], [6,0,0,0,7,5,0,0,9], [0,0,0,6,0,1,0,7,8], [0,0,7,0,4,0,2,6,0], [0,0,1,0,5,0,9,3,0], [9,0,4,0,6,0,0,0,5], [0,7,0,3,0,0,0,1,2], [1,2,0,0,0,7,4,0,0], [0,4,9,2,0,6,0,0,7] ] def solve(board): find = find_empty(board) if not find: retur...
my_board = [[7, 8, 0, 4, 0, 0, 1, 2, 0], [6, 0, 0, 0, 7, 5, 0, 0, 9], [0, 0, 0, 6, 0, 1, 0, 7, 8], [0, 0, 7, 0, 4, 0, 2, 6, 0], [0, 0, 1, 0, 5, 0, 9, 3, 0], [9, 0, 4, 0, 6, 0, 0, 0, 5], [0, 7, 0, 3, 0, 0, 0, 1, 2], [1, 2, 0, 0, 0, 7, 4, 0, 0], [0, 4, 9, 2, 0, 6, 0, 0, 7]] def solve(board): find = find_empty(board)...
def cipher_text(plain_text): res="".join(i.lower() for i in plain_text if i.isalpha()) print(res) if not res: return "" n=len(res)**0.5 square=len(res) if n==int(n) else (int(n)+1)**2 rectangle=int(n)*(int(n)+1) if len(res)>rectangle: rectangle=(rectangle*(int(n)+2))//int(n) ...
def cipher_text(plain_text): res = ''.join((i.lower() for i in plain_text if i.isalpha())) print(res) if not res: return '' n = len(res) ** 0.5 square = len(res) if n == int(n) else (int(n) + 1) ** 2 rectangle = int(n) * (int(n) + 1) if len(res) > rectangle: rectangle = recta...
def add_time(original_time, extra_time, input_day=None): hour, minutes, time_stamp = ' '.join(original_time.split(':')).split() if time_stamp == "PM": hour = int(hour) + 12 hour, minutes = int(hour), int(minutes) extra_hours, extra_minutes = extra_time.split(':') extra_hours, extra_minutes =...
def add_time(original_time, extra_time, input_day=None): (hour, minutes, time_stamp) = ' '.join(original_time.split(':')).split() if time_stamp == 'PM': hour = int(hour) + 12 (hour, minutes) = (int(hour), int(minutes)) (extra_hours, extra_minutes) = extra_time.split(':') (extra_hours, extra_...
# # PySNMP MIB module Unisphere-Data-ACCOUNTING-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-ACCOUNTING-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:30:21 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(acctng_file_entry, acctng_selection_entry, acctng_selection_index) = mibBuilder.importSymbols('ACCOUNTING-CONTROL-MIB', 'acctngFileEntry', 'acctngSelectionEntry', 'acctngSelectionIndex') (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_v...
# To run the announcement service managed by the hub, add this. c.JupyterHub.services = [ { 'name': 'announcement', 'url': 'http://127.0.0.1:8888', 'command': [sys.executable, "-m", "announcement"], } ] # The announcements need to get on the templates somehow, see ...
c.JupyterHub.services = [{'name': 'announcement', 'url': 'http://127.0.0.1:8888', 'command': [sys.executable, '-m', 'announcement']}] c.JupyterHub.template_paths = ['templates']
# References: https://developer.nvidia.com/cuda-gpus nvcc_args = [ # Tesla: K80, K80 # Quadro: (None) # NVIDIA NVS: (None) # Jetson: (None) '-gencode', 'arch=compute_37,code=sm_37', # Tesla: (None) # Quadro: K1200, K620, M1200, M520, M5000M, M4000M, M3000M, M2000M, M1000M, K620M, M...
nvcc_args = ['-gencode', 'arch=compute_37,code=sm_37', '-gencode', 'arch=compute_50,code=sm_50', '-gencode', 'arch=compute_52,code=sm_52', '-gencode', 'arch=compute_60,code=sm_60', '-gencode', 'arch=compute_61,code=sm_61', '-gencode', 'arch=compute_70,code=sm_70', '-w'] cxx_args = ['-std=c++11', '-w']
count = 0 for k in range(5): if int(input()) % 2 == 0: count += 1 print("%d valores pares" % (count))
count = 0 for k in range(5): if int(input()) % 2 == 0: count += 1 print('%d valores pares' % count)
#!/bin/python3 count = "bottles" for i in list(range(99,0,-1)): if i == 1: count = "bottle" if i != 99: print(i, count, "of beer on the wall") print() print(i, count, "of beer on the wall,") print(i, count, "of beer") print() print("Take one down, pass it around,") else: print("no more bottles of beer on t...
count = 'bottles' for i in list(range(99, 0, -1)): if i == 1: count = 'bottle' if i != 99: print(i, count, 'of beer on the wall') print() print(i, count, 'of beer on the wall,') print(i, count, 'of beer') print() print('Take one down, pass it around,') else: print('no...
print(f'\n\n') print(' ---------------- START ---------------- ') # -------------------------------- SCRIPTING ---------------------------------- # ----------------------------------- END ------------------------------------- print(' ----------------- END ----------------- ') print(f'\n')
print(f'\n\n') print(' ---------------- START ---------------- ') print(' ----------------- END ----------------- ') print(f'\n')
opcoes = { "vertebrado":{ "ave":{ "carnivoro": "aguia", "onivoro": "pomba", }, "mamifero":{ "onivoro": "homem", "herbivoro": "vaca", } }, "invertebrado":{ "inseto":{ "hematofago": "pulga", "herbivoro": "lagarta", }, "anelideo":{ "hematofago": "sanguessuga", "onivoro": "minhoca",...
opcoes = {'vertebrado': {'ave': {'carnivoro': 'aguia', 'onivoro': 'pomba'}, 'mamifero': {'onivoro': 'homem', 'herbivoro': 'vaca'}}, 'invertebrado': {'inseto': {'hematofago': 'pulga', 'herbivoro': 'lagarta'}, 'anelideo': {'hematofago': 'sanguessuga', 'onivoro': 'minhoca'}}} a = input() b = input() c = input() print(opco...
# The goal is print "Buzz" if multiple of 5 n = int(input('Insert whole number: ')) if (n % 5) == 0: print('Buzz') else: print(n)
n = int(input('Insert whole number: ')) if n % 5 == 0: print('Buzz') else: print(n)
READY = 10 NOT_INITIALIZED = 11 LOCKED = 13 RECOVERY_IMAGE_MISSING = 14 IMAGE_IS_NOT_AVAILABLE_FOR_RECOVERY = 15 IMAGE_BUILDING_UNAVAILABLE = 16
ready = 10 not_initialized = 11 locked = 13 recovery_image_missing = 14 image_is_not_available_for_recovery = 15 image_building_unavailable = 16
# https://www.codewars.com/kata/5d50e3914861a500121e1958/train/python ''' Instructions : Your task is to add up letters to one letter. The function will be given a variable amount of arguments, each one being a letter to add. Notes: Letters will always be lowercase. Letters can overflow (see second to last example ...
""" Instructions : Your task is to add up letters to one letter. The function will be given a variable amount of arguments, each one being a letter to add. Notes: Letters will always be lowercase. Letters can overflow (see second to last example of the description) If no letters are given, the function should return...
# # PySNMP MIB module HH3C-NET-MAN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-NET-MAN-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:15:55 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
problemMatrix = [ [1, 2, 0, 0, 0], [2, 3, 2, 0, 0], [3, 4, 1, 0, 0], [4, 5, 0, 0, 0], [5, 6, 7, 0, 0] ]
problem_matrix = [[1, 2, 0, 0, 0], [2, 3, 2, 0, 0], [3, 4, 1, 0, 0], [4, 5, 0, 0, 0], [5, 6, 7, 0, 0]]
def init(): pass def run(batch): print(batch)
def init(): pass def run(batch): print(batch)
# This function purpose is encoding a text turning a vowel into k + number of 1 to 5 codification. def encoding(text): container = "" for letter in text: if letter in "a": container = container + "k5" elif letter in "e": container = container + "k4" elif letter in...
def encoding(text): container = '' for letter in text: if letter in 'a': container = container + 'k5' elif letter in 'e': container = container + 'k4' elif letter in 'i': container = container + 'k3' elif letter in 'o': container = ...
A, B = map(int, input().split()) for i in range(A, B+1): if '3' in str(i) or i % 3 == 0: print(i)
(a, b) = map(int, input().split()) for i in range(A, B + 1): if '3' in str(i) or i % 3 == 0: print(i)
N = int(input()) if N==1: print(2) else: remain = 1 for i in range(N): print(remain+1) remain = remain*(remain+1)
n = int(input()) if N == 1: print(2) else: remain = 1 for i in range(N): print(remain + 1) remain = remain * (remain + 1)
# # 0014.py # def avg(lst): return sum(lst) / len(lst) def SS(a, b): aavg = avg(a) bavg = avg(b) ss = 0; N = min(len(a), len(b)) for i in range(0, N): ss += (a[i] - aavg) * (b[i] - bavg) return ss x = [1, 2, 3, 4, 5] y = [2, 5, 8, 11, 14] print("Data") print("x = ", x) print("y = ", y) print() b = SS(x, ...
def avg(lst): return sum(lst) / len(lst) def ss(a, b): aavg = avg(a) bavg = avg(b) ss = 0 n = min(len(a), len(b)) for i in range(0, N): ss += (a[i] - aavg) * (b[i] - bavg) return ss x = [1, 2, 3, 4, 5] y = [2, 5, 8, 11, 14] print('Data') print('x = ', x) print('y = ', y) print() b =...
N = int(input()) A = list(map(int, input().split())) ans = 0 for v in A: ans += 1/v print(1/ans)
n = int(input()) a = list(map(int, input().split())) ans = 0 for v in A: ans += 1 / v print(1 / ans)
#!/usr/bin/env python3 n = int(input()) m = 3 r = [0]*(n+1) #sol[0] is reserved c = [0]*(n+1) s = [0]*(n+n+1) d = [0]*(n+n) #d'=d+n cnt = 0 def stack_dfs(): global n,m,cnt,r,c,s,d #r=stack i = 1 while i>0: j = r[i]+1 while j<=n and (c[j]>0 or s[i+j]>0 or d[i-j+n]>0): j += 1 ...
n = int(input()) m = 3 r = [0] * (n + 1) c = [0] * (n + 1) s = [0] * (n + n + 1) d = [0] * (n + n) cnt = 0 def stack_dfs(): global n, m, cnt, r, c, s, d i = 1 while i > 0: j = r[i] + 1 while j <= n and (c[j] > 0 or s[i + j] > 0 or d[i - j + n] > 0): j += 1 if j <= n: ...
# -*- coding: utf-8 -*- # # Implementation by Pedro Maat C. Massolino, hereby denoted as "the implementer". # # To the extent possible under law, the implementer has waived all copyright # and related or neighboring rights to the source code in this file. # http://creativecommons.org/publicdomain/zero/1.0/ # de...
def generate_vhdl_instantiation_multiplication(temp_number, temp_range): temp_name = 'temp_mult_' + str(temp_number) final_string = 'signal ' + temp_name + ' : ' + 'std_logic_vector(' final_string = final_string + str(temp_range[1]) + ' downto ' + str(temp_range[0]) + ');' return final_string def gener...
class Clock: def __init__(self, hours, mins): self.hours = hours self.mins = mins self.fixup() def __eq__(self, other): return self.hours == other.hours and self.mins == other.mins def __str__(self): return (self.format_hours() + ':' + self.format_mi...
class Clock: def __init__(self, hours, mins): self.hours = hours self.mins = mins self.fixup() def __eq__(self, other): return self.hours == other.hours and self.mins == other.mins def __str__(self): return self.format_hours() + ':' + self.format_mins() def ad...
def convert(json_string: str) ->dict: value_started = False field_name = None result = {} i = 0 while i < len(json_string): char = json_string[i] if not field_name: field_name, json_string = parse_field(json_string) json_string = skip_unnecessary_chars(json_...
def convert(json_string: str) -> dict: value_started = False field_name = None result = {} i = 0 while i < len(json_string): char = json_string[i] if not field_name: (field_name, json_string) = parse_field(json_string) json_string = skip_unnecessary_chars(json...
# test construction of bytes from different objects # long ints print(ord(bytes([14953042807679334000 & 0xff])))
print(ord(bytes([14953042807679334000 & 255])))
class Solution: # Insert (Accepted + Top Voted), O(n^2) time, O(n) space def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]: res = [] for i in range(len(nums)): res.insert(index[i], nums[i]) return res # Slice Assignment (Top Voted), O(n^2) time,...
class Solution: def create_target_array(self, nums: List[int], index: List[int]) -> List[int]: res = [] for i in range(len(nums)): res.insert(index[i], nums[i]) return res def create_target_array(self, nums: List[int], index: List[int]) -> List[int]: target = [] ...
distance = float(input()) day_or_nigh = input() if distance < 20 and day_or_nigh == "day": money = 0.7 + (distance * 0.79) print(f"{money:.2f}") elif distance < 20 and day_or_nigh == "night": money = 0.7 + (distance * 0.9) print(f"{money:.2f}") elif 20 <= distance < 100: money = distance * 0.09 ...
distance = float(input()) day_or_nigh = input() if distance < 20 and day_or_nigh == 'day': money = 0.7 + distance * 0.79 print(f'{money:.2f}') elif distance < 20 and day_or_nigh == 'night': money = 0.7 + distance * 0.9 print(f'{money:.2f}') elif 20 <= distance < 100: money = distance * 0.09 prin...
# TC: O(nlogn) # SC:O(logn) class Solution: def sortList(self, head: ListNode) -> ListNode: def sortFunc(head: ListNode, tail: ListNode) -> ListNode: if not head or not head.next: return head if head.next == tail: ...
class Solution: def sort_list(self, head: ListNode) -> ListNode: def sort_func(head: ListNode, tail: ListNode) -> ListNode: if not head or not head.next: return head if head.next == tail: head.next = None return head fast ...
## ## This file is maintained by Ansible - CHANGES WILL BE OVERWRITTEN ## USERS = ( 'outreach@galaxyproject.org', 'jen@bx.psu.edu', 'anton@bx.psu.edu', 'marius@galaxyproject.org', ) NORM_USERS = [u.lower() for u in USERS] def __dynamic_reserved(key, user_email): if user_email is not None and use...
users = ('outreach@galaxyproject.org', 'jen@bx.psu.edu', 'anton@bx.psu.edu', 'marius@galaxyproject.org') norm_users = [u.lower() for u in USERS] def __dynamic_reserved(key, user_email): if user_email is not None and user_email.lower() in NORM_USERS: return 'reserved_' + key return 'slurm_' + key def d...
class Example(object): def __init__(self, node_features, fc_matrix, y): # TODO: Add data shape validations self.node_features = node_features self.fc_matrix, self.y = fc_matrix, y def to_data_obj(self): pass # TODO
class Example(object): def __init__(self, node_features, fc_matrix, y): self.node_features = node_features (self.fc_matrix, self.y) = (fc_matrix, y) def to_data_obj(self): pass
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next # idea: # pointers: # 1. new list 'res' # 2, 3 - heads h1, h2 # we go on until we have nodes: # pick smallest node and attack to res class Solution: def mergeTwoLists...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def merge_two_lists(self, l1: ListNode, l2: ListNode) -> ListNode: res = None r = res (h1, h2) = (l1, l2) while h1 is not None or h2 is not None: i...
def bytes_to_int(by): result = 0 for b in by: result = result * 256 + int(b) return result
def bytes_to_int(by): result = 0 for b in by: result = result * 256 + int(b) return result
class LightControl: def __init__(self, max_switch, logger, a_address, a_rst_pin, b_address, b_rst_pin): pass def run(self): pass def init(self): pass def can_switch(self, light): pass def update_switched(self, light): pass def schedule_switch(self, li...
class Lightcontrol: def __init__(self, max_switch, logger, a_address, a_rst_pin, b_address, b_rst_pin): pass def run(self): pass def init(self): pass def can_switch(self, light): pass def update_switched(self, light): pass def schedule_switch(self, l...
def relative_coordinates(move): return { "L": (-1*int(move[1:]), 0), "R": (int(move[1:]), 0), "U": (0, -1*int(move[1:])), "D": (0, int(move[1:])), }.get(move[0]) def create_wire(wire, name): global coordinates global crossings position = [0, 0] for move in wir...
def relative_coordinates(move): return {'L': (-1 * int(move[1:]), 0), 'R': (int(move[1:]), 0), 'U': (0, -1 * int(move[1:])), 'D': (0, int(move[1:]))}.get(move[0]) def create_wire(wire, name): global coordinates global crossings position = [0, 0] for move in wire: movement = relative_coordin...
class Solution: def isRationalEqual(self, S: str, T: str) -> bool: def valueOf(s: str) -> float: if s.find('(') == -1: return float(s) integer_nonRepeating = float(s[:s.find('(')]) nonRepeatingLength = s.find('(') - s.find('.') - 1 repeating = float(s[s.find('(') + 1: s.find(')')]...
class Solution: def is_rational_equal(self, S: str, T: str) -> bool: def value_of(s: str) -> float: if s.find('(') == -1: return float(s) integer_non_repeating = float(s[:s.find('(')]) non_repeating_length = s.find('(') - s.find('.') - 1 repe...
#!/usr/bin/env python NAME = 'Barracuda Application Firewall (Barracuda Networks)' def is_waf(self): if self.matchcookie(r'^barra_counter_session='): return True if self.matchcookie(r'^BNI__BARRACUDA_LB_COOKIE='): return True if self.matchcookie(r'^BNI_persistence='): return True...
name = 'Barracuda Application Firewall (Barracuda Networks)' def is_waf(self): if self.matchcookie('^barra_counter_session='): return True if self.matchcookie('^BNI__BARRACUDA_LB_COOKIE='): return True if self.matchcookie('^BNI_persistence='): return True if self.matchcookie('^B...
class Solution: def countSubstrings(self, s: str) -> int: self.counter = 0 def helper(s, l, r): while l >= 0 and r < len(s) and s[l] == s[r]: l -= 1 r += 1 self.counter += 1 for i in range(len(s)): ...
class Solution: def count_substrings(self, s: str) -> int: self.counter = 0 def helper(s, l, r): while l >= 0 and r < len(s) and (s[l] == s[r]): l -= 1 r += 1 self.counter += 1 for i in range(len(s)): helper(s, i, i) ...
{ "targets": [ { "target_name": "beepwin", 'conditions': [ ['OS=="win"', { 'sources': [ 'lib/beepwin.cc', ] }] ] } ] }
{'targets': [{'target_name': 'beepwin', 'conditions': [['OS=="win"', {'sources': ['lib/beepwin.cc']}]]}]}
microcode = ''' def macroop VMOVAPD_XMM_XMM { movfp128 dest=xmm0, src1=xmm0m, dataSize=16 vclear dest=xmm2, destVL=16 }; def macroop VMOVAPD_XMM_M { ldfp128 xmm0, seg, sib, "DISPLACEMENT + 0", dataSize=16 vclear dest=xmm2, destVL=16 }; def macroop VMOVAPD_XMM_P { rdip t7 ldfp128 xmm0, seg, rip...
microcode = '\ndef macroop VMOVAPD_XMM_XMM {\n movfp128 dest=xmm0, src1=xmm0m, dataSize=16\n vclear dest=xmm2, destVL=16\n};\n\ndef macroop VMOVAPD_XMM_M {\n ldfp128 xmm0, seg, sib, "DISPLACEMENT + 0", dataSize=16\n vclear dest=xmm2, destVL=16\n};\n\ndef macroop VMOVAPD_XMM_P {\n rdip t7\n ldfp128 xmm...
''' Functions for producing csproj-style XML for various kinds of content. Used by generate_sample_solutions to update the .csproj files for individual projects. ''' def get_csproj_xml_for_nuget_packages(nuget_version_list): ''' param nuget_version_list: a list of dictionaries. keys are 'name' and 'version...
""" Functions for producing csproj-style XML for various kinds of content. Used by generate_sample_solutions to update the .csproj files for individual projects. """ def get_csproj_xml_for_nuget_packages(nuget_version_list): """ param nuget_version_list: a list of dictionaries. keys are 'name' and 'version...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowestCommonAncestor(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowest_common_ancestor(self, root: TreeNode, p: TreeNode, q: TreeNode) -> TreeNode: (smaller, greater) = sorted([p.val, q.val]) while not smaller <= root.val <= g...
# python3 class Request: def __init__(self, arrival_time, process_time): self.arrival_time = arrival_time self.process_time = process_time class Response: def __init__(self, dropped, start_time): self.dropped = dropped self.start_time = start_time class Buffer: ...
class Request: def __init__(self, arrival_time, process_time): self.arrival_time = arrival_time self.process_time = process_time class Response: def __init__(self, dropped, start_time): self.dropped = dropped self.start_time = start_time class Buffer: def __init__(self, ...
#!/usr/bin/env python # coding=utf-8 ''' Author: John Email: johnjim0816@gmail.com Date: 2020-07-30 23:01:40 LastEditor: John LastEditTime: 2020-08-03 10:13:24 Discription: Environment: ''' # Source : https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/ # Author : JohnJim0816 # Date : 2020-07-30 ...
""" Author: John Email: johnjim0816@gmail.com Date: 2020-07-30 23:01:40 LastEditor: John LastEditTime: 2020-08-03 10:13:24 Discription: Environment: """ class Solution: def lowest_common_ancestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': if not root or root == p or root == q: ...
# Copyright 2019 the rules_javascript authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
load('//javascript/internal:providers.bzl', _JavaScriptInfo='JavaScriptInfo', _NodeModulesInfo='NodeModulesInfo') load('//javascript/node:node.bzl', _node_common='node_common') toolchain_type = '@rules_javascript//tools/babel:toolchain_type' babel_config_info = provider(fields=['files', 'babel_config_file']) babel_pres...
def add(x,y): print(x+y) add(5,3) def sayHello(): print("Hello") # sayHello("Hi") This does not work as sayHello() takes no args def sayHello(name): print(f"Hello {name}") sayHello("Brent") # Keyword arguments def sayHello(name, surname): print(f"Hello {name} {surname}") sayHello(surname = "Bren...
def add(x, y): print(x + y) add(5, 3) def say_hello(): print('Hello') def say_hello(name): print(f'Hello {name}') say_hello('Brent') def say_hello(name, surname): print(f'Hello {name} {surname}') say_hello(surname='Brent', name='Littlefield') def divide(dividend, divisor): if divisor != 0: ...
#!/usr/bin/env python # In case of poor (Sh***y) commenting contact adam.lamson@colorado.edu # Basic ''' Name: ase1_styles Description: Dictionaries of different styles that you can use Input: Output: ''' ase1_runs_stl = { "axes.titlesize": 18, "axes.labelsize": 15, "lines.linewidth": 3, "lines.marker...
""" Name: ase1_styles Description: Dictionaries of different styles that you can use Input: Output: """ ase1_runs_stl = {'axes.titlesize': 18, 'axes.labelsize': 15, 'lines.linewidth': 3, 'lines.markersize': 10, 'xtick.labelsize': 15, 'ytick.labelsize': 15, 'font.size': 15} ase1_sims_stl = {'axes.titlesize': 25, 'axes.l...
# Copyright (C) 2020-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 QUANTIZE_AGNOSTIC_OPERATIONS = [ {'type': 'MaxPool'}, {'type': 'ReduceMax'}, {'type': 'Reshape'}, {'type': 'Concat'}, {'type': 'Flatten'}, {'type': 'Squeeze'}, {'type': 'Unsqueeze'}, {'type': 'Split'}, ...
quantize_agnostic_operations = [{'type': 'MaxPool'}, {'type': 'ReduceMax'}, {'type': 'Reshape'}, {'type': 'Concat'}, {'type': 'Flatten'}, {'type': 'Squeeze'}, {'type': 'Unsqueeze'}, {'type': 'Split'}, {'type': 'VariadicSplit'}, {'type': 'Crop'}, {'type': 'Transpose'}, {'type': 'Tile'}, {'type': 'StridedSlice'}, {'type'...
# Dictionary person = {'name': 'Joseph Mtinangi', 'college': 'CIVE'} # Print the dictionary print(person) # Print all keys print('Keys') print(person.keys()) print('Values') print(person.values()) print('All') print(person.items())
person = {'name': 'Joseph Mtinangi', 'college': 'CIVE'} print(person) print('Keys') print(person.keys()) print('Values') print(person.values()) print('All') print(person.items())
km=float(input("Enter the distance in km : \t")) miles=km*0.621 cel=float(input("Enter the temp in celsius: \t")) far=((9/5)*cel)+32 print("Distance in miles :",miles," \nTemperature in Fahrenheit: ",far)
km = float(input('Enter the distance in km : \t')) miles = km * 0.621 cel = float(input('Enter the temp in celsius: \t')) far = 9 / 5 * cel + 32 print('Distance in miles :', miles, ' \nTemperature in Fahrenheit: ', far)
# Copyright 2015 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
sass_filetypes = file_type(['.sass', '.scss']) def collect_transitive_sources(ctx): source_files = set(order='compile') for dep in ctx.attr.deps: source_files += dep.transitive_sass_files return source_files def _sass_library_impl(ctx): transitive_sources = collect_transitive_sources(ctx) ...
# # PySNMP MIB module SERVICE-LOCATION-PROTOCOL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SERVICE-LOCATION-PROTOCOL-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:01:52 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python ve...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, value_range_constraint, constraints_intersection, single_value_constraint) ...
def maxSum(num_list, n, k): if n < k: print("Invalid") return -1 max_sum = 0 for i in range(k): max_sum += num_list[i] window_sum = max_sum for i in range(k,n): window_sum += num_list[i] - num_list[i - k] max_sum = max(max_sum, window_sum) return max_sum...
def max_sum(num_list, n, k): if n < k: print('Invalid') return -1 max_sum = 0 for i in range(k): max_sum += num_list[i] window_sum = max_sum for i in range(k, n): window_sum += num_list[i] - num_list[i - k] max_sum = max(max_sum, window_sum) return max_sum...
y = 123 y = "Hola Mundo" def sum(a,b): return a+b print(sum(3,4)) def toUnderscore(word): return word.replace(" ", "_") print(toUnderscore(y)) def changeLetters(string): for x in string: if(x.isupper()): print(x.lower()) else: print(x.upper()) changeLetters(y) ...
y = 123 y = 'Hola Mundo' def sum(a, b): return a + b print(sum(3, 4)) def to_underscore(word): return word.replace(' ', '_') print(to_underscore(y)) def change_letters(string): for x in string: if x.isupper(): print(x.lower()) else: print(x.upper()) change_letters(...
ADVIL = "Advil" ALEVE = "Aleve" CELEBREX = "Celebrex" COLCRYS = "Colcrys" INDOCIN = "Indocin" METHYLPRED = "Methylprednisolone" MOBIC = "Mobic" OTHERTREATMENT = "Other treatment" PRED = "Prednisone" TINCTUREOFTIME = "Tincture of time" UNDERONE = "under 24 hours" ONETOTHREE = "more than 1 but less than 3 days" THREETOS...
advil = 'Advil' aleve = 'Aleve' celebrex = 'Celebrex' colcrys = 'Colcrys' indocin = 'Indocin' methylpred = 'Methylprednisolone' mobic = 'Mobic' othertreatment = 'Other treatment' pred = 'Prednisone' tinctureoftime = 'Tincture of time' underone = 'under 24 hours' onetothree = 'more than 1 but less than 3 days' threetose...
class Brain(): def __init__(self): self.experiences = []
class Brain: def __init__(self): self.experiences = []
s = input() t = input() s = [i for i in s] t = [i for i in t] s.sort() t.sort() t.reverse() s = "".join(s) t = "".join(t) if s < t: print("Yes") else: print("No")
s = input() t = input() s = [i for i in s] t = [i for i in t] s.sort() t.sort() t.reverse() s = ''.join(s) t = ''.join(t) if s < t: print('Yes') else: print('No')
# transcribing DNA into RNA DNA_seq = str(input("Input DNA-sequence: ")) DNA_seq = str.upper(DNA_seq) RNA_complement = "" n = len(DNA_seq) - 1 while n >= 0: if DNA_seq[n] == "A": RNA_complement += "A" n = n - 1 elif DNA_seq[n] == "T": RNA_complement += "U" n = n - 1 elif D...
dna_seq = str(input('Input DNA-sequence: ')) dna_seq = str.upper(DNA_seq) rna_complement = '' n = len(DNA_seq) - 1 while n >= 0: if DNA_seq[n] == 'A': rna_complement += 'A' n = n - 1 elif DNA_seq[n] == 'T': rna_complement += 'U' n = n - 1 elif DNA_seq[n] == 'C': rna_c...
def read(filname, delimiter=','): res = [] with open(filname, 'r', encoding = 'utf-8') as f: table = f.readlines() for row in table: res.append(row.strip('\n').split(delimiter)) return res def write(filename, table, delimiter=','): rows = len(table) columns = len(table[0]) wi...
def read(filname, delimiter=','): res = [] with open(filname, 'r', encoding='utf-8') as f: table = f.readlines() for row in table: res.append(row.strip('\n').split(delimiter)) return res def write(filename, table, delimiter=','): rows = len(table) columns = len(table[0]) wit...
A, B, C, D = map(int, input().split()) if A * D == B * C: print('DRAW') elif B * C > A * D: print('TAKAHASHI') else: print('AOKI')
(a, b, c, d) = map(int, input().split()) if A * D == B * C: print('DRAW') elif B * C > A * D: print('TAKAHASHI') else: print('AOKI')
numbers = int(input()) char = int(input()) + 97 for i in range(1, numbers + 1): for i2 in range(1, numbers + 1): for i3 in range(97, char): for i4 in range(97, char): for i5 in range(1, numbers + 1): if i < i5 > i2: print(f"{i}{i2}{chr...
numbers = int(input()) char = int(input()) + 97 for i in range(1, numbers + 1): for i2 in range(1, numbers + 1): for i3 in range(97, char): for i4 in range(97, char): for i5 in range(1, numbers + 1): if i < i5 > i2: print(f'{i}{i2}{chr(...
debug = False pieces = "pnbrqk" def xy_to_i(xy: tuple) -> int: return xy[0] + 8 * xy[1] def i_to_xy(i: int) -> tuple: return (i % 8, i // 8) def add_chunk(result: list, offset: int, chunk: int): if not offset: result[-1] |= chunk else: result.append(chunk << 4) def encode(data: d...
debug = False pieces = 'pnbrqk' def xy_to_i(xy: tuple) -> int: return xy[0] + 8 * xy[1] def i_to_xy(i: int) -> tuple: return (i % 8, i // 8) def add_chunk(result: list, offset: int, chunk: int): if not offset: result[-1] |= chunk else: result.append(chunk << 4) def encode(data: dict)...
# Copyright (c) 2020 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # TANIUM_DETECT_DEFAULT_LIMIT = 100 TANIUM_DETECT_MAX_LIMIT = 500 TANIUM_DETECT_API_BASE_URL = '/plugin/products/detect3/api/v1' TANIUM_DETECT_API_PATH_SUPPRESSION_RULES = '/suppression-rules' TANIUM_DETECT_...
tanium_detect_default_limit = 100 tanium_detect_max_limit = 500 tanium_detect_api_base_url = '/plugin/products/detect3/api/v1' tanium_detect_api_path_suppression_rules = '/suppression-rules' tanium_detect_api_path_sources = '/sources' tanium_detect_api_path_source_types = '/source-types' tanium_detect_api_path_notifica...
a = set(map(int, input().split())) for x in range(int(input())): b = set(map(int, input().split())) if len(b.intersection(a))<len(b): print("False") exit() print("True")# Enter your code here. Read input from STDIN. Print output to STDOUT
a = set(map(int, input().split())) for x in range(int(input())): b = set(map(int, input().split())) if len(b.intersection(a)) < len(b): print('False') exit() print('True')
class Logger(): ''' Logs information about model progress into a file ''' def __init__(self, filename=None): if filename is None: self.f = None else: self.f = open(filename,'a') def log(self, message): ''' Adds message file ''' print(message) ...
class Logger: """ Logs information about model progress into a file """ def __init__(self, filename=None): if filename is None: self.f = None else: self.f = open(filename, 'a') def log(self, message): """ Adds message file """ print(message) ...
class InvalidBudget(Exception): def __init__(self, msg): self.msg = msg def __unicode__(self): return self.msg
class Invalidbudget(Exception): def __init__(self, msg): self.msg = msg def __unicode__(self): return self.msg
class Solution: def numJewelsInStones(self, J: str, S: str) -> int: num=0 list1=[x for x in J] for i in S: if i in list1: num+=1 return num
class Solution: def num_jewels_in_stones(self, J: str, S: str) -> int: num = 0 list1 = [x for x in J] for i in S: if i in list1: num += 1 return num
guang python-Levenshtein psutil pretty_errors ephem dill # itchat # numpy # streamlit # pandas # matplotlib # plotly # treetable
guang python - Levenshtein psutil pretty_errors ephem dill
__version__ = '0.1.2' __author__ = 'Alexander Thebelt' __author_email__ = 'alexander.thebelt18@imperial.ac.uk' __license__ = 'BSD 3-Clause License'
__version__ = '0.1.2' __author__ = 'Alexander Thebelt' __author_email__ = 'alexander.thebelt18@imperial.ac.uk' __license__ = 'BSD 3-Clause License'
def can_build(env, platform): return True def configure(env): pass def get_doc_classes(): return [ "CharacterAtlasEntry", "CharacterAtlas", "ESS", "AuraGroup", "CraftRecipeHelper", "CraftRecipe", "EquipmentData", "ItemInstance", "Ite...
def can_build(env, platform): return True def configure(env): pass def get_doc_classes(): return ['CharacterAtlasEntry', 'CharacterAtlas', 'ESS', 'AuraGroup', 'CraftRecipeHelper', 'CraftRecipe', 'EquipmentData', 'ItemInstance', 'ItemTemplate', 'ModelVisualEntry', 'ModelVisual', 'SpellCooldownManipulationD...
# -*- coding: utf-8 -*- # License: See LICENSE file. required_states = ['position','age'] required_matrices = ['cellular_binary_life'] def run(name, world, matrices, states, extra_life=10): y,x = states['position'] if matrices['cellular_binary_life'][int(y),int(x)]: # Eat the cell under the agent's p...
required_states = ['position', 'age'] required_matrices = ['cellular_binary_life'] def run(name, world, matrices, states, extra_life=10): (y, x) = states['position'] if matrices['cellular_binary_life'][int(y), int(x)]: matrices['cellular_binary_life'][int(y), int(x)] = False states['age'] += ex...