content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class Solution: def XXX(self, root: TreeNode) -> List[List[int]]: if root is None: return [] wai = []; nei = [] nextQue = [root]; queue = [] while True: if nextQue: root = nextQue.pop(0) nei.append(root.val) if root.left and...
class Solution: def xxx(self, root: TreeNode) -> List[List[int]]: if root is None: return [] wai = [] nei = [] next_que = [root] queue = [] while True: if nextQue: root = nextQue.pop(0) nei.append(root.val) ...
def check(fun): def checksub(x,y): if x<y: print(" x is less than y ans is negative.....") fun(x,y) return checksub @check def sub(a,b): a=int(input(" enter the value of a: ")) b=int(input("enter the value of b: ")) z=a-b print("ans: ",z)
def check(fun): def checksub(x, y): if x < y: print(' x is less than y ans is negative.....') fun(x, y) return checksub @check def sub(a, b): a = int(input(' enter the value of a: ')) b = int(input('enter the value of b: ')) z = a - b print('ans: ', z)
# class Tree: # def __init__(self, val, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def solve(self, root1, root2): def inorder(root,level): if root is None: return inorder(root.left,leve...
class Solution: def solve(self, root1, root2): def inorder(root, level): if root is None: return inorder(root.left, level) if root.left is None and root.right is None: level.append(root.val) inorder(root.right, level) ...
class UnionFind: def __init__(self, n): self.parent = list(range(n)) self.rank = [1] * n def find(self, p): if p != self.parent[p]: self.parent[p] = self.find(self.parent[p]) return self.parent[p] def union(self, p, q): root_p, root_q = self.find(p), s...
class Unionfind: def __init__(self, n): self.parent = list(range(n)) self.rank = [1] * n def find(self, p): if p != self.parent[p]: self.parent[p] = self.find(self.parent[p]) return self.parent[p] def union(self, p, q): (root_p, root_q) = (self.find(p),...
# # PySNMP MIB module ALTEON-CHEETAH-BWM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTEON-CHEETAH-BWM-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:05:08 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (d...
(aws_switch,) = mibBuilder.importSymbols('ALTEON-ROOT-MIB', 'aws-switch') (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersec...
# Jenny's secret message # Jenny has written a function that returns a greeting for a user. However, # she's in love with Johnny, and would like to greet him slightly different. # She added a special case to her function, but she made a mistake. # Can you help her? def greet(name): if name == "Johnny": ...
def greet(name): if name == 'Johnny': return 'Hello, my love!' return 'Hello, {name}!'.format(name=name) print(greet('Johnny')) print(greet('Jimm'))
class Solution: def minSwaps(self, data: List[int]) -> int: left=0 right=0 cur_ones=0 sum_ones = sum(data) max_ones=0 while right<len(data): cur_ones+=data[right] right+=1 if right-left>sum_ones: cur_ones-=data[left]...
class Solution: def min_swaps(self, data: List[int]) -> int: left = 0 right = 0 cur_ones = 0 sum_ones = sum(data) max_ones = 0 while right < len(data): cur_ones += data[right] right += 1 if right - left > sum_ones: ...
def print_formatted(number): padding = len(bin(number)[2:]) for i in range(1, number+1): decimal = str(i) octo = oct(i)[2:] hexa = hex(i)[2:].upper() binary = bin(i)[2:] padded_d = f"{' '*(padding-len(decimal))}{decimal}" padded_o = f"{' '*(padding-len(oc...
def print_formatted(number): padding = len(bin(number)[2:]) for i in range(1, number + 1): decimal = str(i) octo = oct(i)[2:] hexa = hex(i)[2:].upper() binary = bin(i)[2:] padded_d = f"{' ' * (padding - len(decimal))}{decimal}" padded_o = f"{' ' * (padding - len(o...
def create(mist_session, site_id, assetfilter_settings): uri = "/api/v1/sites/%s/assetfilters" % site_id body = assetfilter_settings resp = mist_session.mist_post(uri, site_id=site_id, body=body) return resp def update(mist_session, site_id, assetfilter_id, body={}): uri = "/api/v1/sites/%s/assetfi...
def create(mist_session, site_id, assetfilter_settings): uri = '/api/v1/sites/%s/assetfilters' % site_id body = assetfilter_settings resp = mist_session.mist_post(uri, site_id=site_id, body=body) return resp def update(mist_session, site_id, assetfilter_id, body={}): uri = '/api/v1/sites/%s/assetfi...
def testfunc(mydict, key, data): print('testing dictionary') print(type(mydict)) mydict[key] = data if "num" in mydict: mydict["num"] = mydict["num"] + 1 else: mydict["num"] = 1 print(mydict) def spinfunc(mat, num): return num + 1
def testfunc(mydict, key, data): print('testing dictionary') print(type(mydict)) mydict[key] = data if 'num' in mydict: mydict['num'] = mydict['num'] + 1 else: mydict['num'] = 1 print(mydict) def spinfunc(mat, num): return num + 1
def nb_dims(dataset): if dataset in ["unipen1a", "unipen1b", "unipen1c"]: return 2 return 1 def nb_classes(dataset): if dataset=='MFPT': return 15 if dataset == 'XJTU': return 15 if dataset == "CricketX": return 12 #300 if dataset == "UWaveGestureLibraryAll": ...
def nb_dims(dataset): if dataset in ['unipen1a', 'unipen1b', 'unipen1c']: return 2 return 1 def nb_classes(dataset): if dataset == 'MFPT': return 15 if dataset == 'XJTU': return 15 if dataset == 'CricketX': return 12 if dataset == 'UWaveGestureLibraryAll': ...
#!/usr/bin/python bin_num = bin(int(input())) count = 0 for char in bin_num: if char == '1': count += 1 print(count)
bin_num = bin(int(input())) count = 0 for char in bin_num: if char == '1': count += 1 print(count)
def f(arr): s = set(arr) count = 0 for i in range(len(arr)): check = arr[i]+1 if check in s: count+=1 print(count) return count arr = [1,1,3,3,5,5,7,7] arr = [1,3,2,3,5,0] f(arr)
def f(arr): s = set(arr) count = 0 for i in range(len(arr)): check = arr[i] + 1 if check in s: count += 1 print(count) return count arr = [1, 1, 3, 3, 5, 5, 7, 7] arr = [1, 3, 2, 3, 5, 0] f(arr)
class Puntaje: def __init__(self, view_width, font): # type: (object, object) -> object self.view_width = view_width self.font = font self.counter = 0 def draw(self, bg): msg = self.font.render(str(self.counter), True, (0, 0, 0)) ...
class Puntaje: def __init__(self, view_width, font): self.view_width = view_width self.font = font self.counter = 0 def draw(self, bg): msg = self.font.render(str(self.counter), True, (0, 0, 0)) bg.blit(msg, (self.view_width - 36, 0)) def add(self): self.co...
# Part 1 of the Python Review lab. def hello_world(): print("hello world") def greet_by_name(name): print("hello"+name) def encode(x): num=x+3953531 def decode(): num=encode(34) new=num-3953531 greet_by_name("maya")
def hello_world(): print('hello world') def greet_by_name(name): print('hello' + name) def encode(x): num = x + 3953531 def decode(): num = encode(34) new = num - 3953531 greet_by_name('maya')
x=0 while(x < 20): x+=1 if(x%3 == 0): continue print(x) # The continue will skip the loop and then it will go back to the next iteration.
x = 0 while x < 20: x += 1 if x % 3 == 0: continue print(x)
'''Settings for metabase.''' # Database connection strings for database containing data. metabase_connection_string = 'postgresql://metaadmin@localhost:5432/postgres' # Database connection strings for database containing data. data_connection_string = 'postgresql://metaadmin@localhost:5432/postgres'
"""Settings for metabase.""" metabase_connection_string = 'postgresql://metaadmin@localhost:5432/postgres' data_connection_string = 'postgresql://metaadmin@localhost:5432/postgres'
fname = input('Enter the file name: ') try: fhand = open(fname) except: print('File cannot be opened: ', fname) quit() count = 0 for line in fhand: if line.startswith('Subject:'): count = count+1 print('there where',count,'subject lines in', fname)
fname = input('Enter the file name: ') try: fhand = open(fname) except: print('File cannot be opened: ', fname) quit() count = 0 for line in fhand: if line.startswith('Subject:'): count = count + 1 print('there where', count, 'subject lines in', fname)
#!/usr/bin/env python3 def check_permutation(str1, str2): pass print(check_permutation("god", "dog")) # True print(check_permutation("hello", "goodbye")) # False
def check_permutation(str1, str2): pass print(check_permutation('god', 'dog')) print(check_permutation('hello', 'goodbye'))
def sort(L): #for x in L: flag = True for i in range(len(L)-1): #if x > y: if L[i] > L[i+1]: #switch(x,y) nextSpot = L[i+1] L[i+1] = L[i] L[i] = nextSpot flag = False if flag: return L else: return sort(L) def r...
def sort(L): flag = True for i in range(len(L) - 1): if L[i] > L[i + 1]: next_spot = L[i + 1] L[i + 1] = L[i] L[i] = nextSpot flag = False if flag: return L else: return sort(L) def remove_x_from_list(x, theList): if len(theLis...
spots = [[c for c in n.strip()] for n in open('d11in.txt').read().splitlines()] height = len(spots) width = len(spots[0]) def neighbors_occupied(x, y): neighbors = [(ix, iy) for ix in range(x-1, x+2) for iy in range(y-1, y+2) if 0 <= ix < width and 0 <= iy < height and not (ix == x and iy == y)] return sum([1...
spots = [[c for c in n.strip()] for n in open('d11in.txt').read().splitlines()] height = len(spots) width = len(spots[0]) def neighbors_occupied(x, y): neighbors = [(ix, iy) for ix in range(x - 1, x + 2) for iy in range(y - 1, y + 2) if 0 <= ix < width and 0 <= iy < height and (not (ix == x and iy == y))] retu...
# # Name: cp949 to Unicode table # Unicode version: 2.0 # Table version: 2.01 # Table format: Format A # Date: 1/7/2000 # # Contact: Shawn.Steele@microsoft.com # # General notes: none # # Format: Three tab-separated columns # Column #1 is the cp949 code (in hex) # ...
uni_conv_table = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15, 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 32: 32, 33: 33, 34: 34, 35: 35, 36: 36, 37: 37, 38: 38, 39: 39, 40...
def solution(): l=[*map(int,input().split())] for i in range(1, 40000000): if i % l[0] == l[3] and i % l[1] == l[4] and i % l[2] == l[5]: return i return -1 print(solution())
def solution(): l = [*map(int, input().split())] for i in range(1, 40000000): if i % l[0] == l[3] and i % l[1] == l[4] and (i % l[2] == l[5]): return i return -1 print(solution())
l = float(input('Qual a medida da largura em metros?')) h = float(input('Qual a altura em metros?')) area = l * h print(f'Sua parede mede {l} x {h} e sua area e de {area}') tinta = area / 2 print(f'Voce precisara de {tinta}L de tinta para pintar-la.')
l = float(input('Qual a medida da largura em metros?')) h = float(input('Qual a altura em metros?')) area = l * h print(f'Sua parede mede {l} x {h} e sua area e de {area}') tinta = area / 2 print(f'Voce precisara de {tinta}L de tinta para pintar-la.')
for n in range(20): print('testing dict with {} items'.format(n)) for i in range(n): # create dict d = dict() for j in range(n): d[str(j)] = j print(len(d)) # delete an item del d[str(i)] print(len(d)) # check items for j in r...
for n in range(20): print('testing dict with {} items'.format(n)) for i in range(n): d = dict() for j in range(n): d[str(j)] = j print(len(d)) del d[str(i)] print(len(d)) for j in range(n): if str(j) in d: if j == i: ...
n = int(input()) x = 2*n-1 A = [[0]*x for _ in range(x)] c = n for k in range(n): for i in range(k,x-k): for j in range(k,x-k): A[i][j] = c c-=1 for i in range(x): for j in range(x): print(f"{A[i][j]}",end= " ") print()
n = int(input()) x = 2 * n - 1 a = [[0] * x for _ in range(x)] c = n for k in range(n): for i in range(k, x - k): for j in range(k, x - k): A[i][j] = c c -= 1 for i in range(x): for j in range(x): print(f'{A[i][j]}', end=' ') print()
def get(request): accept_mimetypes = request.headers.get('accept', None) if not accept_mimetypes: return [] return str(accept_mimetypes).split(',') def best_match(request, representations, default=None): if not representations: return default try: accept_mimetypes = get(re...
def get(request): accept_mimetypes = request.headers.get('accept', None) if not accept_mimetypes: return [] return str(accept_mimetypes).split(',') def best_match(request, representations, default=None): if not representations: return default try: accept_mimetypes = get(requ...
def test(): a = 1 b = 2 c = 3 d = 4 i = 0 while i < 1e6: # 100 a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b a = a; a = b; a = c; a = d; b = a; b = b; b = c; b = d; c = a; c = b a = a; a = b; a = c; a = d; b = a...
def test(): a = 1 b = 2 c = 3 d = 4 i = 0 while i < 1000000.0: a = a a = b a = c a = d b = a b = b b = c b = d c = a c = b a = a a = b a = c a = d b = a b = b b...
# An exception that any methods in exchange may raise. class ExchangeException(Exception): def __init__(self, message): Exception.__init__(self, message) # An available market. class Market(object): source_currency_id = None target_currency_id = None market_id = None trade_minimum = 0.0000...
class Exchangeexception(Exception): def __init__(self, message): Exception.__init__(self, message) class Market(object): source_currency_id = None target_currency_id = None market_id = None trade_minimum = 1e-08 def __init__(self, source_currency_id, target_currency_id, market_id, tra...
#question 1 #generate the series # #3 5 8 13 20 31 44 61 80 103 132 163 #method to generate the prime number def prime_number_generator(n): primeList = [0] condition,num = 0,2 while condition < n: for itr in range(2,num): if (num % itr) == 0: ...
def prime_number_generator(n): prime_list = [0] (condition, num) = (0, 2) while condition < n: for itr in range(2, num): if num % itr == 0: break else: primeList.append(num) condition += 1 num += 1 return primeList print('Enter ...
class Notification(object): def __init__(self, notification_id, account_id, viewed, content): self.id = notification_id self.account_id = account_id self.viewed = viewed self.content = content
class Notification(object): def __init__(self, notification_id, account_id, viewed, content): self.id = notification_id self.account_id = account_id self.viewed = viewed self.content = content
# # PySNMP MIB module ELSA-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELSA-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:59:56 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ...
def isLetter(string): if not len(string) == 1: raise TypeError("Get case excpeted a string of 1.") elif ord(string.lower()) >= 97 and ord(string.lower()) <= 122: return(True) else: return False def getCase(string): if not len(string) == 1: raise TypeError("Get case excpet...
def is_letter(string): if not len(string) == 1: raise type_error('Get case excpeted a string of 1.') elif ord(string.lower()) >= 97 and ord(string.lower()) <= 122: return True else: return False def get_case(string): if not len(string) == 1: raise type_error('Get case ex...
def fib(num): if num == 0: return 0 fib_cache = [0 for _ in range(num + 1)] fib_cache[1] = 1 for i in range(num + 1): if i < 2: continue # IT IS KEY TO PAY STRONG ATTENTION TO THE MATH FORMULA # AND KEEP IT MIND THIS IS NOT DOING DECREASING RECURSIVE fib_cache[i] = fib...
def fib(num): if num == 0: return 0 fib_cache = [0 for _ in range(num + 1)] fib_cache[1] = 1 for i in range(num + 1): if i < 2: continue fib_cache[i] = fib_cache[i - 1] + fib_cache[i - 2] return fib_cache[num] print(fib(0)) print(fib(1)) print(fib(2)) print(fib(3)...
def file_line_counter(file_name=""): with open(file_name) as file: file_line_count = len(file.read().split("\n")) return file_line_count def get_local_command(input_file="", output_file="", mapper="", reducer=""): return "cat " + repr(input_file) + " | python3 " + mapper + " | sort | python3 " + reducer + " > " ...
def file_line_counter(file_name=''): with open(file_name) as file: file_line_count = len(file.read().split('\n')) return file_line_count def get_local_command(input_file='', output_file='', mapper='', reducer=''): return 'cat ' + repr(input_file) + ' | python3 ' + mapper + ' | sort | python3 ' + re...
async def verifica_canal_online(self, dados): _aux_stream = await self.bot._http.get_streams(user_ids = [dados['canal_id']]) get_stream = [{'type': 'None'}] if _aux_stream == [] else _aux_stream get_stream = get_stream[0] _stream_online = True if get_stream['type'] == 'live' else False return _strea...
async def verifica_canal_online(self, dados): _aux_stream = await self.bot._http.get_streams(user_ids=[dados['canal_id']]) get_stream = [{'type': 'None'}] if _aux_stream == [] else _aux_stream get_stream = get_stream[0] _stream_online = True if get_stream['type'] == 'live' else False return _stream_...
__all__ = [ 'booking', 'channel', 'chat', 'check_in', 'client', 'crypto_manager', 'http_api', 'packet', 'writer']
__all__ = ['booking', 'channel', 'chat', 'check_in', 'client', 'crypto_manager', 'http_api', 'packet', 'writer']
_base_ = [ '../bead/retinanet_r50_fpn.py', '../_base_/datasets/bead_cropped_type_2.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # optimizer optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
_base_ = ['../bead/retinanet_r50_fpn.py', '../_base_/datasets/bead_cropped_type_2.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'] optimizer = dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001)
# Python3 implementation to count # ways to sum up to a given value N # Function to count the total # number of ways to sum up to 'N' def countWays(arr, m, N): count = [0 for i in range(N + 1)] # base case count[0] = 1 # Count ways for all values up # to 'N' and store the result for i in range(1, ...
def count_ways(arr, m, N): count = [0 for i in range(N + 1)] count[0] = 1 for i in range(1, N + 1): for j in range(m): if i >= arr[j]: count[i] += count[i - arr[j]] return count[N] arr = [1, 5, 6] m = len(arr) n = 7 print('Total number of ways = ', count_ways(arr, m, ...
x,y = input().split(" ") HI = int(x) HF = int(y) total = 0 if HI > HF: for a in range(HI + 1, 25): total += 1 if a == 24: for b in range(1, HF+1): total += 1 elif HI < HF: total = HF - HI else: total = 24 print("O JOGO DUROU %d HORA(S)" %total)
(x, y) = input().split(' ') hi = int(x) hf = int(y) total = 0 if HI > HF: for a in range(HI + 1, 25): total += 1 if a == 24: for b in range(1, HF + 1): total += 1 elif HI < HF: total = HF - HI else: total = 24 print('O JOGO DUROU %d HORA(S)' % total)
def poorbottle(): i01.setHandSpeed("left", 0.60, 0.60, 0.60, 0.60, 0.60, 0.60) i01.setHandSpeed("right", 0.60, 0.80, 0.60, 0.60, 0.60, 0.60) i01.setArmSpeed("left", 0.60, 0.60, 0.65, 0.60) i01.setArmSpeed("right", 0.60, 0.60, 0.60, 0.60) i01.setHeadSpeed(0.65, 0.65) i01.moveHead(0,92) i01.setTorsoSpeed(1....
def poorbottle(): i01.setHandSpeed('left', 0.6, 0.6, 0.6, 0.6, 0.6, 0.6) i01.setHandSpeed('right', 0.6, 0.8, 0.6, 0.6, 0.6, 0.6) i01.setArmSpeed('left', 0.6, 0.6, 0.65, 0.6) i01.setArmSpeed('right', 0.6, 0.6, 0.6, 0.6) i01.setHeadSpeed(0.65, 0.65) i01.moveHead(0, 92) i01.setTorsoSpeed(1.0, 1...
# -*- mode: python -*- # vi: set ft=python : load( "@drake//tools/workspace:github.bzl", "github_archive", ) def libfranka_legacy_repository( name, mirrors = None): github_archive( name = name, repository = "frankaemika/libfranka", commit = "0.7.1", sha256 =...
load('@drake//tools/workspace:github.bzl', 'github_archive') def libfranka_legacy_repository(name, mirrors=None): github_archive(name=name, repository='frankaemika/libfranka', commit='0.7.1', sha256='6a4ad0fa9451ddc6d2a66231ee8ede3686d6e3b67fd4cd9966ba30bdc82b9408', build_file='//tools/workspace/libfranka_legacy:p...
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def reConstructBinaryTree(self, pre, vin): if len(pre) == 0: return None elif len(pre) == 1: return TreeNode(pre[0]) else: ...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def re_construct_binary_tree(self, pre, vin): if len(pre) == 0: return None elif len(pre) == 1: return tree_node(pre[0]) else: ...
country = input().split(", ") capital = input().split(", ") dictionary = {key: value for (key, value) in zip(country, capital)} [print(f"{key} -> {value}") for (key, value) in dictionary.items()]
country = input().split(', ') capital = input().split(', ') dictionary = {key: value for (key, value) in zip(country, capital)} [print(f'{key} -> {value}') for (key, value) in dictionary.items()]
# bad for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]: print (i**2) # good for i in range(10): print (i**2) colors = ['red', 'green', 'blue', 'yellow'] for color in colors: print (color) for color in reversed(colors): print (color) for i, color in enumerate(colors): print (i, '-->', colors[i]) names ...
for i in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]: print(i ** 2) for i in range(10): print(i ** 2) colors = ['red', 'green', 'blue', 'yellow'] for color in colors: print(color) for color in reversed(colors): print(color) for (i, color) in enumerate(colors): print(i, '-->', colors[i]) names = ['jeanne', 'maxim...
if __name__ == "__main__": forecasts = open("forecasts.csv", "r").readlines() old_value = 1 new_list = [] for f in forecasts[1:]: strpf = f.replace('"','').strip() new_str = "%s,%s\n" % (strpf, old_value) newspl = new_str.strip().split(",") final_str = "%s,%s\n" % (newspl...
if __name__ == '__main__': forecasts = open('forecasts.csv', 'r').readlines() old_value = 1 new_list = [] for f in forecasts[1:]: strpf = f.replace('"', '').strip() new_str = '%s,%s\n' % (strpf, old_value) newspl = new_str.strip().split(',') final_str = '%s,%s\n' % (newsp...
class Solution: def maxArea(self, height: List[int]) -> int: highest = 0 left, right = 0, len(height)-1 while left < right: curr = min(height[left], height[right])*(right-left) highest = max(highest, curr) if height[left] < height[right]: l...
class Solution: def max_area(self, height: List[int]) -> int: highest = 0 (left, right) = (0, len(height) - 1) while left < right: curr = min(height[left], height[right]) * (right - left) highest = max(highest, curr) if height[left] < height[right]: ...
# Colors (R, G , B) WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) DARKGRAY = (40, 40, 40) LIGHTGRAY = (100, 100, 100) # Game settings GAME_TITLE = "PyGame Template" SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 FPS = 60 BACKGROUND_COLOR = DARKGRAY
white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) green = (0, 255, 0) blue = (0, 0, 255) yellow = (255, 255, 0) darkgray = (40, 40, 40) lightgray = (100, 100, 100) game_title = 'PyGame Template' screen_width = 800 screen_height = 600 fps = 60 background_color = DARKGRAY
#Original code by Ian McLoughlin #Week 2: Programming and Scriping #cost = 14.99 #taxperc = 23 #tax = taxperc / 100 #saleprc = cost * (1.0 + tax) #print("Sale price: %0.2f" % saleprc) i= 11 print(i) j= 12 print(j) k = i * j print(k) f = 12.34 print(f) g = 0.99 print(g) s = "Hello, World!" print(s) print(s[0])...
i = 11 print(i) j = 12 print(j) k = i * j print(k) f = 12.34 print(f) g = 0.99 print(g) s = 'Hello, World!' print(s) print(s[0]) print(s[:5]) print(s[7:12]) l = [2, 3, 5, 7, 11] print(l) print(l[2])
# Can be multiple prefixes, like this: ("!", "?") BOT_PREFIX = ("%") TOKEN = "ODI3MjkzNzkwMzgwNDkwNzcy.YGY7Yg.vo2qefP9XNsieXNuh3cJNr6Tqng" APPLICATION_ID = "827293790380490772" OWNERS = [123456789, 987654321] BLACKLIST = [] # Bot colors main_color = 0xD75BF4 error = 0xE02B2B success = 0x42F56C warning = 0xF59E42 info ...
bot_prefix = '%' token = 'ODI3MjkzNzkwMzgwNDkwNzcy.YGY7Yg.vo2qefP9XNsieXNuh3cJNr6Tqng' application_id = '827293790380490772' owners = [123456789, 987654321] blacklist = [] main_color = 14113780 error = 14691115 success = 4388204 warning = 16096834 info = 4364789
class Feature(object): ''' Computing for Instrument. ''' @classmethod def computeForInstrument(cls, updateNum, time, featureParams, featureKey, instrumentManager): raise NotImplementedError return None ''' Computing for Market. ''' @classmethod def computeForMar...
class Feature(object): """ Computing for Instrument. """ @classmethod def compute_for_instrument(cls, updateNum, time, featureParams, featureKey, instrumentManager): raise NotImplementedError return None '\n Computing for Market.\n ' @classmethod def compute_for_m...
class Config: DEBUG = True DEBUG_EMAILS = True TESTING = True HOST = "localhost" PUBLIC_HOST = HOST PORT = 8000 SERVER_NAME = "http://{}:{}".format(PUBLIC_HOST, PORT) MONGO_TABLE = "tests" MONGO = {"host": PUBLIC_HOST, "port": 27017, "db": MONGO_TABLE} MONGO_URI = "mongodb://{host}:{port}/{db}".fo...
class Config: debug = True debug_emails = True testing = True host = 'localhost' public_host = HOST port = 8000 server_name = 'http://{}:{}'.format(PUBLIC_HOST, PORT) mongo_table = 'tests' mongo = {'host': PUBLIC_HOST, 'port': 27017, 'db': MONGO_TABLE} mongo_uri = 'mongodb://{hos...
# Script: DistanceTraveled.py # Description: This program asks the user for the speed of a vehicle (in miles per hour) # and the number of hours it has traveled. It then use a loop to display the distance # the vehicle has traveled for each hour of that time period using the formula: # ...
def main(): speed = int(input('Please Enter the speed of the vehicle(in miles per hour): ')) print() number_of_hours = int(input('Please Enter the number of hours the vehicle has traveled: ')) print() print() print('Hour\tDistance Traveled') print('------------------------') for hour in ...
class EvaluacionFinalInstructor: count = 0 def __init__(self,vars): self.pk = self.count self.p1 = vars[6] self.p2 = vars[7] self.p3 = vars[8] self.p4 = vars[9] self.p5 = vars[10] self.p6 = vars[11] self.p7 = vars[12] self.p8 = vars[13] ...
class Evaluacionfinalinstructor: count = 0 def __init__(self, vars): self.pk = self.count self.p1 = vars[6] self.p2 = vars[7] self.p3 = vars[8] self.p4 = vars[9] self.p5 = vars[10] self.p6 = vars[11] self.p7 = vars[12] self.p8 = vars[13] ...
def factorial(num): if num == 1: return 1 else: return num * factorial(num-1) n = k = 20 n += 20 c = factorial(n) / (factorial(n-k) * factorial(k)) print(c)
def factorial(num): if num == 1: return 1 else: return num * factorial(num - 1) n = k = 20 n += 20 c = factorial(n) / (factorial(n - k) * factorial(k)) print(c)
# -*- coding: utf-8 -*- # @Author: 1uci3n # @Date: 2021-10-07 17:59:35 # @Last Modified by: 1uci3n # @Last Modified time: 2021-10-07 17:59:55 class Solution: def isPalindrome(self, x: int) -> bool: if x < 0: return False if x < 10: return True ints = [x % 10] ...
class Solution: def is_palindrome(self, x: int) -> bool: if x < 0: return False if x < 10: return True ints = [x % 10] x = x // 10 while x > 0: ints.append(x % 10) x = x // 10 if len(ints) % 2 == 0: for i in...
# Create dummy secrey key so we can use sessions SECRET_KEY = '7d44d441f2756sdera7d441f2b6176a' # Create in-memory database DATABASE_FILE = 'sample_db.sqlite' SQLALCHEMY_DATABASE_URI = 'sqlite:///' + DATABASE_FILE SQLALCHEMY_ECHO = False # Flask-Security config SECURITY_URL_PREFIX = "/admin" SECURITY_PASSWO...
secret_key = '7d44d441f2756sdera7d441f2b6176a' database_file = 'sample_db.sqlite' sqlalchemy_database_uri = 'sqlite:///' + DATABASE_FILE sqlalchemy_echo = False security_url_prefix = '/admin' security_password_hash = 'pbkdf2_sha512' security_password_salt = 'ATGUOHAELKiubahiughaerGOJAEGj' security_login_url = '/login/'...
# https://www.hackerrank.com/challenges/nested-list/problem l = [] second_lowest_names = [] scores = set() for _ in range(int(input())): name = input() score = float(input()) l.append([name, score]) scores.add(score) second_lowest = sorted(scores)[1] for name, score in l: if score == sec...
l = [] second_lowest_names = [] scores = set() for _ in range(int(input())): name = input() score = float(input()) l.append([name, score]) scores.add(score) second_lowest = sorted(scores)[1] for (name, score) in l: if score == second_lowest: second_lowest_names.append(name) for name in sorte...
''' Description : Creating Decorator Explicitly V2 Function Date : 14 Mar 2021 Function Author : Prasad Dangare Input : Int Output : Int ''' # Inbuilt function from module def Substraction(no1,no2): print("3 : Inside Substraction") return no1 - no2 def SubDeco...
""" Description : Creating Decorator Explicitly V2 Function Date : 14 Mar 2021 Function Author : Prasad Dangare Input : Int Output : Int """ def substraction(no1, no2): print('3 : Inside Substraction') return no1 - no2 def sub_decorator(func_name): print('7 : Inside Sub...
class Solution: def minAreaFreeRect(self, points: List[List[int]]) -> float: d = collections.defaultdict(list) for px, py in itertools.combinations(points, 2): mx = (px[0] + py[0]) / 2 my = (px[1] + py[1]) / 2 r2 = (px[0] - py[0]) ** 2 + (px[1] - py[1]) ** 2 ...
class Solution: def min_area_free_rect(self, points: List[List[int]]) -> float: d = collections.defaultdict(list) for (px, py) in itertools.combinations(points, 2): mx = (px[0] + py[0]) / 2 my = (px[1] + py[1]) / 2 r2 = (px[0] - py[0]) ** 2 + (px[1] - py[1]) ** 2...
a = int(input()) b = int(input()) print (a//b) print (a/b) #https://www.hackerrank.com/challenges/python-division/problem
a = int(input()) b = int(input()) print(a // b) print(a / b)
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) def array(N, A, B): cnt = 0 A.sort(reverse = True) B.sort() for x in range(N): cnt += A[x] * B[x] return cnt print(array(N,A,B))
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) def array(N, A, B): cnt = 0 A.sort(reverse=True) B.sort() for x in range(N): cnt += A[x] * B[x] return cnt print(array(N, A, B))
# # PySNMP MIB module CHECKPOINT-GAIA-TRAP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CHECKPOINT-GAIA-TRAP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:31:11 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
pessoas = {'nome': 'Erik', 'sexo': 'M', 'idade': 21} print(pessoas) # print(pessoas[0]) print(pessoas['nome']) print(pessoas['idade']) print(f'O {pessoas["nome"]} tem {pessoas["idade"]} anos.') print('-=' * 10) print(pessoas.keys()) print('-=' * 10) print(pessoas.values()) print('-=' * 10) print(pessoas.items()) print(...
pessoas = {'nome': 'Erik', 'sexo': 'M', 'idade': 21} print(pessoas) print(pessoas['nome']) print(pessoas['idade']) print(f"O {pessoas['nome']} tem {pessoas['idade']} anos.") print('-=' * 10) print(pessoas.keys()) print('-=' * 10) print(pessoas.values()) print('-=' * 10) print(pessoas.items()) print('-=' * 10)
frequency = 0 with open("Day 1 - input", "r") as f: for line in f: frequency += int(line.strip()) print(frequency)
frequency = 0 with open('Day 1 - input', 'r') as f: for line in f: frequency += int(line.strip()) print(frequency)
class KarixError(Exception): pass
class Karixerror(Exception): pass
source_str = input() print(f'{source_str.replace("a", "o")} ,' f' {source_str.count("a")} letters replaced,' f' String Length : {len(source_str)}' )
source_str = input() print(f"{source_str.replace('a', 'o')} , {source_str.count('a')} letters replaced, String Length : {len(source_str)}")
# _*_ coding: utf-8 _*_ # # Package: src.ui.builders __all__ = ["car_builder", "customer_builder", "employee_builder"]
__all__ = ['car_builder', 'customer_builder', 'employee_builder']
try: ... #do-not-change-me except: pass
try: ... except: pass
def integrate(func, lower_limit, upper_limit, step): integral = 0 half_step = step / 2 cur_val = lower_limit while cur_val < upper_limit: cur_val += half_step integral += func(cur_val) * step cur_val += half_step return integral
def integrate(func, lower_limit, upper_limit, step): integral = 0 half_step = step / 2 cur_val = lower_limit while cur_val < upper_limit: cur_val += half_step integral += func(cur_val) * step cur_val += half_step return integral
class HostEntry: def __init__(self, name, address): self._name = name self._address = address @property def name(self): return self._name @property def address(self): return self._address def __str__(self): return f"HostEntry(name={self.name}, address={...
class Hostentry: def __init__(self, name, address): self._name = name self._address = address @property def name(self): return self._name @property def address(self): return self._address def __str__(self): return f'HostEntry(name={self.name}, address=...
# suma x, y, z = 10, 23, 5 a = x + y + z # 38 a = x + x + x # 30 a = y + y + y + y # 92 a = z + y + z # 33 a = z + z + z # 15 a = y + y + z # 51 print("Final")
(x, y, z) = (10, 23, 5) a = x + y + z a = x + x + x a = y + y + y + y a = z + y + z a = z + z + z a = y + y + z print('Final')
# https://leetcode.com/problems/combination-sum/ class Solution: def combinationSum( self, candidates: list[int], target: int) -> list[list[int]]: dp = [[] for _ in range(target + 1)] dp[0] = [[]] for candidate in candidates: for target_idx in range(candidate, len(dp...
class Solution: def combination_sum(self, candidates: list[int], target: int) -> list[list[int]]: dp = [[] for _ in range(target + 1)] dp[0] = [[]] for candidate in candidates: for target_idx in range(candidate, len(dp)): for combination in dp[target_idx - candid...
while True: x=input().split() if x[0]=="#": break result=[] for i in range(len(x[0])): diff=ord(x[1][i])-ord(x[0][i]) if diff<0: diff+=26 base=ord(x[2][i])-ord('a') after=(base+diff)%26 result.append(chr(ord('a')+after)) print(x[0],x[1],x[2],"".join(result)...
while True: x = input().split() if x[0] == '#': break result = [] for i in range(len(x[0])): diff = ord(x[1][i]) - ord(x[0][i]) if diff < 0: diff += 26 base = ord(x[2][i]) - ord('a') after = (base + diff) % 26 result.append(chr(ord('a') + after...
n = int(input()) even = 0 odd = 0 for i in range(n): num = int(input()) if i % 2 == 0: even += num else: odd += num if even == odd: print(f"Yes\nSum = {even}") else: print(f"No\nDiff = {abs(even - odd)}")
n = int(input()) even = 0 odd = 0 for i in range(n): num = int(input()) if i % 2 == 0: even += num else: odd += num if even == odd: print(f'Yes\nSum = {even}') else: print(f'No\nDiff = {abs(even - odd)}')
class ImportConfig: class FunctionName: import_csv = "import_csv" @staticmethod def row_converter(table_name: str): return f"import_{table_name}" class VariableName: csv_path = "csv_path" csv_file = "csv_file" csv_row = "csv_row" csv_field = "...
class Importconfig: class Functionname: import_csv = 'import_csv' @staticmethod def row_converter(table_name: str): return f'import_{table_name}' class Variablename: csv_path = 'csv_path' csv_file = 'csv_file' csv_row = 'csv_row' csv_field =...
def lis_n2(x): N = len(x) d = [0] * N d[0] = 1 for i in range(1, N): # don't need to find j # Need just to calculate maxd: max_d = 0 for j in range(i): if x[j] < x[i] and d[j] > max_d: max_d = d[j] d[i] = max_d + 1 return max(d) i...
def lis_n2(x): n = len(x) d = [0] * N d[0] = 1 for i in range(1, N): max_d = 0 for j in range(i): if x[j] < x[i] and d[j] > max_d: max_d = d[j] d[i] = max_d + 1 return max(d) if __name__ == '__main__': n = int(input()) x = list(map(int, inp...
print('___') t = '' k = 0 def unqueue(): global t global k if len(t) == 0: k += 1 t += str(k) x = t[0] t = t[1:] return x stops = [1, 10, 100, 1000, 10000, 100000, 1000000] product = 1 for x in range(1, 1000001): n = unqueue() if x in stops: print(x, n) product *= int(n) print(product)
print('___') t = '' k = 0 def unqueue(): global t global k if len(t) == 0: k += 1 t += str(k) x = t[0] t = t[1:] return x stops = [1, 10, 100, 1000, 10000, 100000, 1000000] product = 1 for x in range(1, 1000001): n = unqueue() if x in stops: print(x, n) p...
# Theory: Magic methods # There are different ways to enrich the functionality of # your classes in Python. One of them is creating custom # method which you've already learned about. Another # way, the one we'll cover in this topic, is using "magic" # methods. # 1. What are "magic" methods? # Magic methods are speci...
class Sun: n = 0 def __new__(cls): if cls.n == 0: cls.n += 1 return object.__new__(cls) sun1 = sun() sun2 = sun() print(sun1) print(sun2) class Transaction: def __init__(self, number, funds, status='active'): self.number = number self.funds = funds ...
{ 'targets': [ { 'target_name': 'binding', 'win_delay_load_hook': 'true', 'sources': [ 'src/time.cpp' ], 'include_dirs': [ '<!(node -e "require(\'nan\')")' ] } ] }
{'targets': [{'target_name': 'binding', 'win_delay_load_hook': 'true', 'sources': ['src/time.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")']}]}
class Solution: def findRepeatedDnaSequences(self, s: str) -> List[str]: if len(s)<=10: return [] subStr, result = set(), set() for i in range(len(s)-9): if s[i:i+10] in subStr: result.add(s[i:i+10]) else: subStr.add(s[i:i+1...
class Solution: def find_repeated_dna_sequences(self, s: str) -> List[str]: if len(s) <= 10: return [] (sub_str, result) = (set(), set()) for i in range(len(s) - 9): if s[i:i + 10] in subStr: result.add(s[i:i + 10]) else: s...
{ 'targets': [ { 'target_name': 'zutil_bindings', 'sources': [ './src/zone.cc', './src/zonecfg.cc', './src/zutil_bindings.cc' ], 'libraries': [ '-lpthread', '-lzonecfg' ], 'cflags_cc': [ '-Wno-write-strings' ], 'cflags_cc!': [ '-fno-exceptions' ], } ] }
{'targets': [{'target_name': 'zutil_bindings', 'sources': ['./src/zone.cc', './src/zonecfg.cc', './src/zutil_bindings.cc'], 'libraries': ['-lpthread', '-lzonecfg'], 'cflags_cc': ['-Wno-write-strings'], 'cflags_cc!': ['-fno-exceptions']}]}
n,m=map(int,input().split()) pos=0 x=[str(i) for i in range(1,n+1)] r=[] while pos<len(x): t=m-1 while t: x.append(x[pos]) pos+=1 t-=1 r.append(x[pos]) pos+=1 print('<'+', '.join(r)+'>')
(n, m) = map(int, input().split()) pos = 0 x = [str(i) for i in range(1, n + 1)] r = [] while pos < len(x): t = m - 1 while t: x.append(x[pos]) pos += 1 t -= 1 r.append(x[pos]) pos += 1 print('<' + ', '.join(r) + '>')
def tensor_feature(t): res = t.sum() try: res += t[1][2].sum() except Exception: pass try: res += (t[2][1] * t[3][0]).sum() except Exception: pass try: res += (t < 0).float().mean() except Exception: pass try: res += (t[-1] < 0.5).float().mean() except Exception: pass return res
def tensor_feature(t): res = t.sum() try: res += t[1][2].sum() except Exception: pass try: res += (t[2][1] * t[3][0]).sum() except Exception: pass try: res += (t < 0).float().mean() except Exception: pass try: res += (t[-1] < 0.5).f...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def insertionSortList(self, head: ListNode) -> ListNode: dummyHead = ListNode(float('-inf')) dummyHead.next = head current = ...
class Solution: def insertion_sort_list(self, head: ListNode) -> ListNode: dummy_head = list_node(float('-inf')) dummyHead.next = head current = dummyHead.next while current and current.next: if current.val <= current.next.val: current = current.next ...
# 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 hasPathSum(self, root: TreeNode, targetSum: int) -> bool: return self.dfs(root, targetSum, 0) ...
class Solution: def has_path_sum(self, root: TreeNode, targetSum: int) -> bool: return self.dfs(root, targetSum, 0) def dfs(self, root, targetSum, currentSum): if not root: return None current_sum += root.val if not root.left and (not root.right): return...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: if not l1: return l2 if not l2: return l1 dh...
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: if not l1: return l2 if not l2: return l1 dhead = list_node(-1) pcra...
s = "" i = 0 while i < 777: s += '*' i += 1 print(s)
s = '' i = 0 while i < 777: s += '*' i += 1 print(s)
# coding: utf-8 def load_stopwords(file_path): stopwords = set() with open(file_path, 'r') as input_file: for line in input_file.readlines(): stopwords.add(line.strip('\n')) return stopwords
def load_stopwords(file_path): stopwords = set() with open(file_path, 'r') as input_file: for line in input_file.readlines(): stopwords.add(line.strip('\n')) return stopwords
''' NOTE: all this code is a placeholder for now. The classifier evaluator will be made before this one, and this should follow whatever patterns are created in there. ''' def evaluate_model(model, inputs, outputs, is_classification=True): if is_classification: print("evaluating classification model") e...
""" NOTE: all this code is a placeholder for now. The classifier evaluator will be made before this one, and this should follow whatever patterns are created in there. """ def evaluate_model(model, inputs, outputs, is_classification=True): if is_classification: print('evaluating classification model') ...
#!/usr/bin/python # # Copyright 2018-2020 Polyaxon, Inc. # # 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 ...
class Polyaxonserviceheaders: cli_version = 'X_POLYAXON_CLI_VERSION' client_version = 'X_POLYAXON_CLIENT_VERSION' internal = 'X_POLYAXON_INTERNAL' service = 'X_POLYAXON_SERVICE' @staticmethod def get_header(header): return header.replace('_', '-') class Polyaxonservices: platform =...
class DaemonService: def __init__(self): pass def get(self): pass
class Daemonservice: def __init__(self): pass def get(self): pass
a, b ,c = input().split(' ') a = int(a) b = int(b) c = int(c) maiorABC = int((a+b+abs(a-b))/2) if maiorABC > c: print(f'{maiorABC} eh o maior') else: print(f'{c} eh o maior')
(a, b, c) = input().split(' ') a = int(a) b = int(b) c = int(c) maior_abc = int((a + b + abs(a - b)) / 2) if maiorABC > c: print(f'{maiorABC} eh o maior') else: print(f'{c} eh o maior')
my_file = open("tasklist.txt", "+w") def option1(): print(taskList) def option2(): add1 = input("What would you like to add?") taskList.append(add1) print(taskList) def option3(): delete1 = int(input("Which number would you like to delete?")) delete1 = delete1-1 print("Item has been deleted....
my_file = open('tasklist.txt', '+w') def option1(): print(taskList) def option2(): add1 = input('What would you like to add?') taskList.append(add1) print(taskList) def option3(): delete1 = int(input('Which number would you like to delete?')) delete1 = delete1 - 1 print('Item has been del...
#A simple program that plays around with array in Python def printArr(myList): #Print whole array for x in myList: print(x,"",end='') myList = ["|BEGIN|","|Bougdanov|",'a',3.142,"END\n"] myList.append("Reversal-Bull-Flag") #Work like a push_back printArr(myList) myList.reverse() #Reverse the or...
def print_arr(myList): for x in myList: print(x, '', end='') my_list = ['|BEGIN|', '|Bougdanov|', 'a', 3.142, 'END\n'] myList.append('Reversal-Bull-Flag') print_arr(myList) myList.reverse() print_arr(myList) myList.pop(2) print_arr(myList) dope_list = [1, 2, 3, ['a', 'b', 'c', [6, 6, 6]]] print('\n' + str(d...
# Example python code for demonstrating AIN Cloud beta. # # This code prints out all the prime numbers found in the given range. def is_prime_number(num): if num < 2: return False for i in range(2, num): if num % i == 0: return False return True def gen_prime_number(max_val): for i in range(max_...
def is_prime_number(num): if num < 2: return False for i in range(2, num): if num % i == 0: return False return True def gen_prime_number(max_val): for i in range(max_val): if is_prime_number(i): print(i) gen_prime_number(100)
z,p,w,u,s = input,print,min,int,abs n = u(z()) v = [] for i in z().split(): t = u(i) v.append(t) q = [] for i in v: q.append(s(0-i)) try: if q.count(w(q)) > 1: _a = [] _min = v[q.index(w(q))] for i in range(len(q)): if s(_min) == s(v[i]): _a.append(i) ...
(z, p, w, u, s) = (input, print, min, int, abs) n = u(z()) v = [] for i in z().split(): t = u(i) v.append(t) q = [] for i in v: q.append(s(0 - i)) try: if q.count(w(q)) > 1: _a = [] _min = v[q.index(w(q))] for i in range(len(q)): if s(_min) == s(v[i]): ...
class Solution: def powerfulIntegers(self, x: int, y: int, bound: int) -> List[int]: if x > 1: xx = [] prod = 1 while prod <= bound: xx.append(prod) prod *= x else: xx=[1] if y > 1: yy = [] ...
class Solution: def powerful_integers(self, x: int, y: int, bound: int) -> List[int]: if x > 1: xx = [] prod = 1 while prod <= bound: xx.append(prod) prod *= x else: xx = [1] if y > 1: yy = [] ...
# # PySNMP MIB module ARCserve-Alarm-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ARCserve-Alarm-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:24:48 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint, constraints_union) ...
# -*- coding: utf-8 -*- __version__ = '1.1.3' PROJECT_NAME = "galaxy_sequence_utils" PROJECT_OWNER = PROJECT_USERAME = "galaxyproject" PROJECT_AUTHOR = 'Dan Blankenberg, Galaxy Project and Community' PROJECT_EMAIL = 'galaxy-dev@lists.galaxyproject.org' PROJECT_URL = "https://github.com/galaxyproject/sequence_utils"...
__version__ = '1.1.3' project_name = 'galaxy_sequence_utils' project_owner = project_userame = 'galaxyproject' project_author = 'Dan Blankenberg, Galaxy Project and Community' project_email = 'galaxy-dev@lists.galaxyproject.org' project_url = 'https://github.com/galaxyproject/sequence_utils'