content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
JournalFame = {"4" : 1200, "5" : 2400, "6" : 4800, "7" : 9600, "8" : 19200} FameGenerated = {"4": {"2Hweapon":720, "1Hweapon":540, "BigArmor":360, "SmallArmor":180}, "5": {"2Hweapon":2880, "1Hweapon":2160, "BigArmor":1440, "SmallArmor"...
journal_fame = {'4': 1200, '5': 2400, '6': 4800, '7': 9600, '8': 19200} fame_generated = {'4': {'2Hweapon': 720, '1Hweapon': 540, 'BigArmor': 360, 'SmallArmor': 180}, '5': {'2Hweapon': 2880, '1Hweapon': 2160, 'BigArmor': 1440, 'SmallArmor': 720}, '6': {'2Hweapon': 8640, '1Hweapon': 6480, 'BigArmor': 4320, 'SmallArmor':...
class ExtraException(Exception): def __init__(self, message: str = None, **kwargs): if message: self.message = message self.extra = kwargs super().__init__(message, kwargs) def __str__(self) -> str: return self.message class PackageNotFoundError(ExtraException, L...
class Extraexception(Exception): def __init__(self, message: str=None, **kwargs): if message: self.message = message self.extra = kwargs super().__init__(message, kwargs) def __str__(self) -> str: return self.message class Packagenotfounderror(ExtraException, Looku...
class Solution: # @param A : list of integers # @return an integer ''' Facebook Codelab No hints or solutions needed N light bulbs are connected by a wire. Each bulb has a switch associated with it, however due to faulty wiring, a switch also changes the state of all the bulbs to the right of ...
class Solution: """ Facebook Codelab No hints or solutions needed N light bulbs are connected by a wire. Each bulb has a switch associated with it, however due to faulty wiring, a switch also changes the state of all the bulbs to the right of current bulb. Given an initial state of all bulbs, find the ...
def main(): recursion() def recursion(): count = [0] num = b(5, 2, count) print(num) # print(sum(count)) print(count[0]) def b(n, k, count): # count.append(1) ## count the number of stack frame count[0] += 1 if k == 0 or k == n: print('Base Case!') return 2 else: return b(n-1...
def main(): recursion() def recursion(): count = [0] num = b(5, 2, count) print(num) print(count[0]) def b(n, k, count): count[0] += 1 if k == 0 or k == n: print('Base Case!') return 2 else: return b(n - 1, k - 1, count) + b(n - 1, k, count) if __name__ == '__ma...
# # @lc app=leetcode.cn id=547 lang=python3 # # [547] friend-circles # None # @lc code=end
None
class CaseInsensitiveKey( object ): def __init__( self, key ): self.key = key def __hash__( self ): return hash( self.key.lower() ) def __eq__( self, other ): return self.key.lower() == other.key.lower() def __str__( self ): return self.key GROK_PATTERN_CONF = dict() # B...
class Caseinsensitivekey(object): def __init__(self, key): self.key = key def __hash__(self): return hash(self.key.lower()) def __eq__(self, other): return self.key.lower() == other.key.lower() def __str__(self): return self.key grok_pattern_conf = dict() GROK_PATTERN...
class ValueResolver: def resolve(self, value): if value.kind() == "id": string = self._resolve_id_value(value) elif value.kind() == "node": string = f"Node({self.resolve(value.value)}.value)" elif value.kind() == "arc": string = f"Arc({self.resolve(value.s...
class Valueresolver: def resolve(self, value): if value.kind() == 'id': string = self._resolve_id_value(value) elif value.kind() == 'node': string = f'Node({self.resolve(value.value)}.value)' elif value.kind() == 'arc': string = f'Arc({self.resolve(value....
######################## ### Feature combine ### ######################## #Combine Units: df_tcad = merge_extraction(dfs=[df_tcad,df_units,gdf_16],val=['dba','type1','units','low','high','units_from_type','est_from_type','shape_area']) replace_nan(df_tcad,['units_x','units_y','low','high'],val=0,reverse=True) #Don't f...
df_tcad = merge_extraction(dfs=[df_tcad, df_units, gdf_16], val=['dba', 'type1', 'units', 'low', 'high', 'units_from_type', 'est_from_type', 'shape_area']) replace_nan(df_tcad, ['units_x', 'units_y', 'low', 'high'], val=0, reverse=True) df_tcad.units_y = np.where(df_tcad.est_from_type, np.nan, df_tcad.units_y) df_tcad....
exports = { "name": "Earth", "aspects": { "amulets": [ { "item": "scholar", "effect": "health", "description": "Into the earth is the answer. " "Into the earth lies existance. " "In...
exports = {'name': 'Earth', 'aspects': {'amulets': [{'item': 'scholar', 'effect': 'health', 'description': 'Into the earth is the answer. Into the earth lies existance. Into the earth lies death and memory. Less health for opponents'}, {'item': 'stargazer', 'effect': 'hit', 'description': 'The stars blesses our earth....
def perfect_number(number): printing = "It's not so perfect." checker = number nums = 0 proper_devisors_sum = 0 for num in range(1, int(checker)): if int(checker) % num == 0: nums += int(num) if nums == int(checker): printing = "We have a perfect number!" return p...
def perfect_number(number): printing = "It's not so perfect." checker = number nums = 0 proper_devisors_sum = 0 for num in range(1, int(checker)): if int(checker) % num == 0: nums += int(num) if nums == int(checker): printing = 'We have a perfect number!' return p...
# Get all available modules # help("modules") module_names = [ "micropython", "uhashlib", "uselect", "_onewire", "sys", "uheapq", "ustruct", "builtins", "uarray", "uio", "utime", "cmath", "ubinascii", "ujson", "utimeq", "firmware", "ubluetooth", "umachine", "uzlib", "gc", "ucollections", "uos", "hub", "uctypes", "urand...
module_names = ['micropython', 'uhashlib', 'uselect', '_onewire', 'sys', 'uheapq', 'ustruct', 'builtins', 'uarray', 'uio', 'utime', 'cmath', 'ubinascii', 'ujson', 'utimeq', 'firmware', 'ubluetooth', 'umachine', 'uzlib', 'gc', 'ucollections', 'uos', 'hub', 'uctypes', 'urandom', 'math', 'uerrno', 'ure'] object_list_todo ...
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Summary Functions\n", "\n", "def get_summ_combined_county_annual(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) ...
{'cells': [{'cell_type': 'code', 'execution_count': null, 'metadata': {}, 'outputs': [], 'source': ['# Summary Functions\n', '\n', "def get_summ_combined_county_annual(state, county = '',verification = True, key = 'WaPo'):\n", " '''(str(two letter abbreviation), str, bool, str) -> pd.df\n", ' Returns seller d...
# -*- coding: utf-8 -*- class ProxyMiddleware(object): def __init__(self, proxy_url): self.proxy_url = proxy_url def process_request(self, request, spider): request.meta['proxy'] = self.proxy_url @classmethod def from_crawler(cls, crawler): return cls( proxy_url=c...
class Proxymiddleware(object): def __init__(self, proxy_url): self.proxy_url = proxy_url def process_request(self, request, spider): request.meta['proxy'] = self.proxy_url @classmethod def from_crawler(cls, crawler): return cls(proxy_url=crawler.settings.get('PROXY_URL'))
if 5 == 2: print("aaaa") print("sjjdjdd") else : print("else")
if 5 == 2: print('aaaa') print('sjjdjdd') else: print('else')
n = int(input()) print('*' * (2*n+1)) print('.' + '*' + ' ' * (2*n - 3) + '*' + '.') for i in range(1, n-1): print('.' + '.' * i + '*' + '@' * ((2*n-3) -2*i) + '*' + '.' * i + '.') print('.' * n +'*' + '.' * n) for i in range(1, n-1): print('.' * ((n)-i) + '*' + ' ' * (i-1) + '@' + ' ' * (i-1) + '*' + '.' * ...
n = int(input()) print('*' * (2 * n + 1)) print('.' + '*' + ' ' * (2 * n - 3) + '*' + '.') for i in range(1, n - 1): print('.' + '.' * i + '*' + '@' * (2 * n - 3 - 2 * i) + '*' + '.' * i + '.') print('.' * n + '*' + '.' * n) for i in range(1, n - 1): print('.' * (n - i) + '*' + ' ' * (i - 1) + '@' + ' ' * (i - ...
class Enum: def __init__(self,list): self.list = list def enume(self): for index, val in enumerate(self.list,start=1): print(index,val) e1 = Enum([5,15,45,4,53]) e1.enume()
class Enum: def __init__(self, list): self.list = list def enume(self): for (index, val) in enumerate(self.list, start=1): print(index, val) e1 = enum([5, 15, 45, 4, 53]) e1.enume()
class UserState(object): def __init__(self, user_id): self.user_id = user_id self.conversation_context = {} self.conversation_started = False self.user = None self.ingredient_cuisine = None self.recipe = None
class Userstate(object): def __init__(self, user_id): self.user_id = user_id self.conversation_context = {} self.conversation_started = False self.user = None self.ingredient_cuisine = None self.recipe = None
class Solution: def findKthNumber(self, n: int, k: int) -> int: cur = 1 k -= 1 while k > 0: step, first, last = 0, cur, cur + 1 while first <= n: step += min(last, n + 1) - first first *= 10 last *= 10 if ...
class Solution: def find_kth_number(self, n: int, k: int) -> int: cur = 1 k -= 1 while k > 0: (step, first, last) = (0, cur, cur + 1) while first <= n: step += min(last, n + 1) - first first *= 10 last *= 10 ...
mylines = [] with open('resume.txt', 'rt') as myfile: for myline in myfile: mylines.append(myline) print("Name: ", end="") for c in mylines[0]: if c == "|": break; else: print(c, end="")
mylines = [] with open('resume.txt', 'rt') as myfile: for myline in myfile: mylines.append(myline) print('Name: ', end='') for c in mylines[0]: if c == '|': break else: print(c, end='')
class Interaction: current_os = -1 logger = None def __init__(self, current_os, logger): self.current_os = current_os self.logger = logger def print_info(self): self.logger.raw("This is interaction with Maya") # framework interactions def schema_item_double_click(self,...
class Interaction: current_os = -1 logger = None def __init__(self, current_os, logger): self.current_os = current_os self.logger = logger def print_info(self): self.logger.raw('This is interaction with Maya') def schema_item_double_click(self, param): self.logger....
class GameObject: # this is a generic object: the player, a monster, an item, the stairs... # it's always represented by a character on screen. def __init__(self, x, y, char, color): self.x = x self.y = y self.char = char self.color = color def move(self, dx, dy, tile_m...
class Gameobject: def __init__(self, x, y, char, color): self.x = x self.y = y self.char = char self.color = color def move(self, dx, dy, tile_map): tile = tile_map[self.x + dx][self.y + dy] if not tile.blocked: self.x += dx self.y += dy ...
class Institution(object): institution_name = None website = None industry = None type = None headquarters = None company_size = None founded = None def __init__(self, name=None, website=None, industry=None, type=None, headquarters=None, company_size=None, founded=None): self.n...
class Institution(object): institution_name = None website = None industry = None type = None headquarters = None company_size = None founded = None def __init__(self, name=None, website=None, industry=None, type=None, headquarters=None, company_size=None, founded=None): self.na...
#!/usr/bin/env python3 def insertion_sort(lst): #times for i in range(1,len(lst)): #n - 1 while i > 0 and lst[i-1] > lst[i]: #(n - 1)n lst[i], lst[i-1] = lst[i-1], lst[i] #(n - 1)n/2 ...
def insertion_sort(lst): for i in range(1, len(lst)): while i > 0 and lst[i - 1] > lst[i]: (lst[i], lst[i - 1]) = (lst[i - 1], lst[i]) i -= 1 return lst print(insertion_sort([6, 4, 3, 8, 5]))
def access_required(): pass
def access_required(): pass
class cacheFilesManagerInterface: def __init__(self, cacheRootPath, resourcesRootPath): super().__init__() def createCacheFiles (self, fileInfo): raise NotImplementedError() def deleteCacheFiles (self, fileInfo): raise NotImplementedError() def getCacheFile (self, fileU...
class Cachefilesmanagerinterface: def __init__(self, cacheRootPath, resourcesRootPath): super().__init__() def create_cache_files(self, fileInfo): raise not_implemented_error() def delete_cache_files(self, fileInfo): raise not_implemented_error() def get_cache_file(self, file...
#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ /...
monitoring_core = 'nagios' agent_port = 6556 agent_ports = [] snmp_ports = [] tcp_connect_timeout = 5.0 use_dns_cache = True delay_precompile = False restart_locking = 'abort' check_submission = 'file' aggr_summary_hostname = '%s-s' agent_min_version = 0 check_max_cachefile_age = 0 cluster_max_cachefile_age = 90 piggyb...
#Command line program that performs various conversions def errorMsg(ErrorCode): #Assigning menu methods as values to dictionary keys codes = { 1: MainMenu, 2: CurrencyConverter, 3: TemperatureConverter, 4: MassConverter, 5: LengthConverter } #Extracti...
def error_msg(ErrorCode): codes = {1: MainMenu, 2: CurrencyConverter, 3: TemperatureConverter, 4: MassConverter, 5: LengthConverter} func = codes.get(ErrorCode) print('\nUnrecognized action! Try again.\n') return func() def exit_program(): print('\nExiting Program.') def convert_euro_din(euros): ...
if __name__ == "__main__": Motifs = [ "TCGGGGGTTTTT", "CCGGTGACTTAC", "ACGGGGATTTTC", "TTGGGGACTTTT", "AAGGGGACTTCC", "TTGGGGACTTCC", "TCGGGGATTCAT", "TCGGGGATTCCT", "TAGGGGAACTAC", "TCGGGTATAACC", ]
if __name__ == '__main__': motifs = ['TCGGGGGTTTTT', 'CCGGTGACTTAC', 'ACGGGGATTTTC', 'TTGGGGACTTTT', 'AAGGGGACTTCC', 'TTGGGGACTTCC', 'TCGGGGATTCAT', 'TCGGGGATTCCT', 'TAGGGGAACTAC', 'TCGGGTATAACC']
fibs = {0: 0, 1: 1} def fib(n): if n in fibs: return fibs[n] if n % 2 == 0: fibs[n] = ((2 * fib((n / 2) - 1)) + fib(n / 2)) * fib(n / 2) return fibs[n] fibs[n] = (fib((n - 1) / 2) ** 2) + (fib((n+1) / 2) ** 2) return fibs[n] # limit 100000
fibs = {0: 0, 1: 1} def fib(n): if n in fibs: return fibs[n] if n % 2 == 0: fibs[n] = (2 * fib(n / 2 - 1) + fib(n / 2)) * fib(n / 2) return fibs[n] fibs[n] = fib((n - 1) / 2) ** 2 + fib((n + 1) / 2) ** 2 return fibs[n]
t = int(input()) while t: X, Y = map(int, input().split()) while X>0 and Y>0 : if X>Y: if X%Y==0: X=Y break X = X%Y else: if Y%X==0: Y=X break Y = Y%X print(X+Y) t =...
t = int(input()) while t: (x, y) = map(int, input().split()) while X > 0 and Y > 0: if X > Y: if X % Y == 0: x = Y break x = X % Y else: if Y % X == 0: y = X break y = Y % X print(...
a = int(input()) b = int(input()) r = 0 if a < b: for x in range(a + 1, b): if x % 2 != 0: r += x elif a >= b: for x in range(a - 1, b, -1): if x % 2 != 0: r += x print(r)
a = int(input()) b = int(input()) r = 0 if a < b: for x in range(a + 1, b): if x % 2 != 0: r += x elif a >= b: for x in range(a - 1, b, -1): if x % 2 != 0: r += x print(r)
def regionQuery(self,P,eps): result = [] for d in self.dataSet: if (((d[0]-P[0])**2 + (d[1] - P[1])**2)**0.5)<=eps: result.append(d) return result def expandCluster(self,point,NeighbourPoints,C,eps,MinPts): C.addPoint(point) for p in NeighbourPoints: if ...
def region_query(self, P, eps): result = [] for d in self.dataSet: if ((d[0] - P[0]) ** 2 + (d[1] - P[1]) ** 2) ** 0.5 <= eps: result.append(d) return result def expand_cluster(self, point, NeighbourPoints, C, eps, MinPts): C.addPoint(point) for p in NeighbourPoints: if ...
def main(): n = int(input()) x = sorted(map(int, input().split())) q = int(input()) m = [int(input()) for _ in range(q)] for coin in m: l, r = -1, n while l + 1 < r: mid = (l + r) // 2 if x[mid] <= coin: l = mid else: ...
def main(): n = int(input()) x = sorted(map(int, input().split())) q = int(input()) m = [int(input()) for _ in range(q)] for coin in m: (l, r) = (-1, n) while l + 1 < r: mid = (l + r) // 2 if x[mid] <= coin: l = mid else: ...
with open("opcodes.txt") as f: code = tuple([int(x) for x in f.read().strip().split(',')]) def op1(code, a, b, c, pos): code[c] = a + b return pos+4 def op2(code, a, b, c, pos): code[c] = a * b return pos+4 def op3(code, a, pos): global sysID code[a] = sysID return pos+2 def op4(code, a, pos): glo...
with open('opcodes.txt') as f: code = tuple([int(x) for x in f.read().strip().split(',')]) def op1(code, a, b, c, pos): code[c] = a + b return pos + 4 def op2(code, a, b, c, pos): code[c] = a * b return pos + 4 def op3(code, a, pos): global sysID code[a] = sysID return pos + 2 def op...
# # PySNMP MIB module MSERIES-PORT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MSERIES-PORT-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:15:42 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, constraints_union, value_size_constraint) ...
# # Pelican_manager # __title__ = 'pelican_manager' __description__ = 'easy way to management pelican blog.' __url__ = 'https://github.com/xiaojieluo/pelican-manager' __version__ = '0.2.1' __build__ = 0x021801 __author__ = 'Xiaojie Luo' __author_email__ = 'xiaojieluoff@gmail.com' __license__ = 'Apache 2.0' __copyright_...
__title__ = 'pelican_manager' __description__ = 'easy way to management pelican blog.' __url__ = 'https://github.com/xiaojieluo/pelican-manager' __version__ = '0.2.1' __build__ = 137217 __author__ = 'Xiaojie Luo' __author_email__ = 'xiaojieluoff@gmail.com' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2017 Xiao...
# my_script.py # enlarge function def enlarge(n): return n * 100
def enlarge(n): return n * 100
DEFINE = 'define' BEGIN = 'begin' SET = 'set!' LAMBDA = 'lambda' LET = 'let' LET_STAR = 'let*' LET_REC = 'letrec' OPEN_PARANT = '(' CLOSE_PARANT = ')' ADD = '+' SUB = '-' MULT = '*' DIV = '/' DOT = '.' QUOTE = 'quote' QUASIQUOTE = 'quasiquote' UNQUOTE = 'unquote' UNQUOTE_SPLICING = 'unquote-splicing' APPLY = 'apply' IF...
define = 'define' begin = 'begin' set = 'set!' lambda = 'lambda' let = 'let' let_star = 'let*' let_rec = 'letrec' open_parant = '(' close_parant = ')' add = '+' sub = '-' mult = '*' div = '/' dot = '.' quote = 'quote' quasiquote = 'quasiquote' unquote = 'unquote' unquote_splicing = 'unquote-splicing' apply = 'apply' if...
################################### # File Name : compare_identity_analysis.py ################################### #!/usr/bin/python3 def main(): print ("=== compare identity ===") print (999 is 999) x = 999; y = 999; print (x is y) z = 999; print (x is z) print (id(x)) print (id(y)) ...
def main(): print('=== compare identity ===') print(999 is 999) x = 999 y = 999 print(x is y) z = 999 print(x is z) print(id(x)) print(id(y)) print(id(z)) if __name__ == '__main__': main()
# # PySNMP MIB module FASTPATH-PFC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FASTPATH-PFC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:12:20 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ...
# Copyright (c) 2014, Fundacion Dr. Manuel Sadosky # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of condit...
class X86Systemvparametermanager(object): def __init__(self, emulator): self.__emulator = emulator def __getitem__(self, index): esp = self.__emulator.registers['esp'] return self.__emulator.read_memory(esp + 4 * index + 4, 4) def __setitem__(self, index, value): esp = sel...
def resolve(): ''' code here ''' num_S, num_c = [int(item) for item in input().split()] delta = num_c - num_S *2 scc = 0 if num_S != 0: if num_c // 2 <= num_S : scc = num_c//2 else: scc = num_S scc += delta//4 else: scc = num_...
def resolve(): """ code here """ (num_s, num_c) = [int(item) for item in input().split()] delta = num_c - num_S * 2 scc = 0 if num_S != 0: if num_c // 2 <= num_S: scc = num_c // 2 else: scc = num_S scc += delta // 4 else: scc = ...
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text...
class Template(object): def __init__(self, usages, snippets, blocks): self.usages = usages self.snippets = snippets self.blocks = blocks def accept(self, visitor): visitor.visit_template(self) class Text(object): def __init__(self, text_token): self._token = text_...
#take user inputs for Item code itemCode = input("Item Code : ") while itemCode != "1" and itemCode != "2" and itemCode != "3": print("Invalid Input!! Try again") itemCode = input("Item Code : ") #take user inputs for quantity quantity = input("Quantity : ") quantity = float(quantity) #take user inputs for c...
item_code = input('Item Code : ') while itemCode != '1' and itemCode != '2' and (itemCode != '3'): print('Invalid Input!! Try again') item_code = input('Item Code : ') quantity = input('Quantity : ') quantity = float(quantity) c_type = input('Customer Type (L / N) : ') while cType != 'L' and cType != 'l' and (c...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Keyword TOKEN_TYPE_IF = 0 TOKEN_TYPE_ELIF = 1 TOKEN_TYPE_ELSE = 2 TOKEN_TYPE_FOR = 3 TOKEN_TYPE_IN = 4 TOKEN_TYPE_WHILE = 5 TOKEN_TYPE_BREAK = 6 TOKEN_TYPE_NOT = 7 TOKEN_TYPE_AND = 8 TOKEN_TYPE_OR = 9 TOKEN_TYPE_RETURN = 10 TOKEN_TYPE_IMPORT = 11 TOKEN_TYPE_FUN = 12 TOK...
token_type_if = 0 token_type_elif = 1 token_type_else = 2 token_type_for = 3 token_type_in = 4 token_type_while = 5 token_type_break = 6 token_type_not = 7 token_type_and = 8 token_type_or = 9 token_type_return = 10 token_type_import = 11 token_type_fun = 12 token_type_class = 13 token_type_let = 14 token_type_global =...
############################################################################### '''''' ############################################################################### # import unittest def testfunc(a, b, c, d=4, # another comment /, e: int = 5, # stuff f=6, ...
"""""" def testfunc(a, b, c, d=4, /, e: int=5, f=6, g=7, h=8, *args, i, j=10, k0=11, k1=110, k2=1100, l=12, m=13, n=14, o=15, fee='fee', fie='fie', foe='foe', fum='fum', boo='boo', p=16, **kwargs): print(a, b, c, d, e, f, g, h, args, i, j, k0, k1, k2, l, m, n, o, p, kwargs)
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: retlisthead, retlistpos = None, None lv: int = 0 while l1 is not N...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def add_two_numbers(self, l1: ListNode, l2: ListNode) -> ListNode: (retlisthead, retlistpos) = (None, None) lv: int = 0 while l1 is not None or l2 is not None: ...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def splitListToParts(self, root: ListNode, k: int) -> List[ListNode]: Len = 0 tmp = root while tmp: Len+=1 ...
class Solution: def split_list_to_parts(self, root: ListNode, k: int) -> List[ListNode]: len = 0 tmp = root while tmp: len += 1 tmp = tmp.next part_len = Len // k remain = Len % k res = [] for _ in range(k): head = list_nod...
T = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1%2: print('WIN') else: print('LOSE')
t = int(input()) for _ in range(T): s = input() n_1 = 0 for c in s: if c == '1': n_1 += 1 if n_1 % 2: print('WIN') else: print('LOSE')
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input("Ukucja tekst: ") if(da_li_je_palindrom(nesto)): print("Da, to je palindrom") else: print("Ne to nije palindrom")
def obrnut(tekst): return tekst[::-1] def da_li_je_palindrom(tekst): return tekst == obrnut(tekst) nesto = input('Ukucja tekst: ') if da_li_je_palindrom(nesto): print('Da, to je palindrom') else: print('Ne to nije palindrom')
def arrayPartition(nums): nums.sort() suma=0 for i in range(0,len(nums),2): suma+=min(nums[i],nums[i+1]) return suma nums = [1,4,3,2] print(arrayPartition(nums))
def array_partition(nums): nums.sort() suma = 0 for i in range(0, len(nums), 2): suma += min(nums[i], nums[i + 1]) return suma nums = [1, 4, 3, 2] print(array_partition(nums))
# Write your solution here def spruce(n): row = "*" print("a spruce!") while n > 0: print(" " * (n-1) + row + " " * (n-1)) row += "**" n -= 1 l = int((len(row)-3)/2) print(" " * l + "*" + " " * l) # You can test your function by callil if __name__ == "__main__": spruce(5...
def spruce(n): row = '*' print('a spruce!') while n > 0: print(' ' * (n - 1) + row + ' ' * (n - 1)) row += '**' n -= 1 l = int((len(row) - 3) / 2) print(' ' * l + '*' + ' ' * l) if __name__ == '__main__': spruce(5) spruce(4)
class Node: def __init__(self,key): self.left = None self.right = None self.val = key def printInorder(root): if root: printInorder(root.left) print(root.val), printInorder(root.right) def printPostorder(root): if root: ...
class Node: def __init__(self, key): self.left = None self.right = None self.val = key def print_inorder(root): if root: print_inorder(root.left) (print(root.val),) print_inorder(root.right) def print_postorder(root): if root: print_postorder(root.l...
with open("input.txt") as f: p1 = [] f.readline() line = f.readline() while line != "\n": p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != "": p2.append(int(line.strip())) line = f.readline() game_his...
with open('input.txt') as f: p1 = [] f.readline() line = f.readline() while line != '\n': p1.append(int(line.strip())) line = f.readline() f.readline() p2 = [] line = f.readline() while line != '': p2.append(int(line.strip())) line = f.readline() game_hist...
nota1 = int(input("escriba la prmera nota de su alumno:")) nota2 = int(input("escriba la segunda nota de su alumno:")) nota3 = int(input("escriba la tercera nota de su alumno:")) nota4 = int(input("escriba la cuarta nota de su alumno:")) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo ==...
nota1 = int(input('escriba la prmera nota de su alumno:')) nota2 = int(input('escriba la segunda nota de su alumno:')) nota3 = int(input('escriba la tercera nota de su alumno:')) nota4 = int(input('escriba la cuarta nota de su alumno:')) media = (nota1 + nota2 + nota3 + nota4) / 4 print(media) sapo = True while sapo ==...
# Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param root, a tree node # @return an integer def minDepth(self, root): if root is None: return 0 #...
class Solution: def min_depth(self, root): if root is None: return 0 queue1 = [] queue2 = [] queue1.append(root) queue2.append(1) while queue1: root = queue1.pop(0) depth = queue2.pop(0) if root.left is None and root.ri...
# Python - 3.6.0 Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22)...
Test.describe('Basic tests') Test.assert_equals(sequence_sum(2, 6, 2), 12) Test.assert_equals(sequence_sum(1, 5, 1), 15) Test.assert_equals(sequence_sum(1, 5, 3), 5) Test.assert_equals(sequence_sum(0, 15, 3), 45) Test.assert_equals(sequence_sum(16, 15, 3), 0) Test.assert_equals(sequence_sum(2, 24, 22), 26) Test.assert_...
def test_atom_feed(app): app.get("/stream.atom") def test_rss_feed(app): app.get("/stream.rss")
def test_atom_feed(app): app.get('/stream.atom') def test_rss_feed(app): app.get('/stream.rss')
age = 12 if age < 4: print("Your admission cost is $0.") elif age < 18: print("Your admission cost is $25.") else: print("Your admission cost is $40.") age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f"Your admission cost is ${price}.") age = 12 if age < 4: price = 0 elif ag...
age = 12 if age < 4: print('Your admission cost is $0.') elif age < 18: print('Your admission cost is $25.') else: print('Your admission cost is $40.') age = 12 if age < 4: price = 0 elif age < 18: price = 25 print(f'Your admission cost is ${price}.') age = 12 if age < 4: price = 0 elif age < 18...
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
class Updated: def __init__(self, payload): self.tiers_added = payload['tiersAdded'] self.orb_count_diff = payload['orbCountDiff'] self.inventory_updates = payload['inventoryUpdates']
#2XX Success SUCESS_OK = 200 #4XX Error ERROR_BAD_REQUEST = 400 ERROR_UNAUTHORIZED = 401 ERROR_FORBIDDEN = 403 ERROR_NOT_FOUND = 404 #5xx ERROR_SERVER = 500
sucess_ok = 200 error_bad_request = 400 error_unauthorized = 401 error_forbidden = 403 error_not_found = 404 error_server = 500
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz" s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb" # take 2 strings s1 and s2 including only letters from ato z. # Return a new sorted string, the longest possible, containing distinct letters def longest(s1, s2)...
s1 = 'xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz' s2 = 'xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb' def longest(s1, s2): s = sorted(set(s1 + s2)) return s
def fc(claim, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(su...
def fc(claim, s=None): suffix = '-' + s if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = '-' + s if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(su...
# Given a string, use recursion to output a list of all the possible permutations of a string # If a character is repeated, treat all versions as distinct # Itertools does permutations def permute(s): out = [] # Base case is when there is only one letter if len(s) < 2: out = [s] else: # For every let...
def permute(s): out = [] if len(s) < 2: out = [s] else: for (i, letter) in enumerate(s): for perm in permute(s[:i] + s[i + 1:]): out += [let + perm] return out s = 'abc' print(permute(s))
# from https://github.com/peteboyd/lammps_interface.git ATOMIC_MASSES = { "H": 1.00794, "He": 4.002602, "Li": 6.941, "Be": 9.012182, "B": 10.811, "C": 12.0107, "N": 14.0067, "O": 15.9994, "F": 18.9984032, "Ne": 20.1797, "Na": 22.98976928, "Mg": 24.3050, "Al": 26.9815...
atomic_masses = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811, 'C': 12.0107, 'N': 14.0067, 'O': 15.9994, 'F': 18.9984032, 'Ne': 20.1797, 'Na': 22.98976928, 'Mg': 24.305, 'Al': 26.9815386, 'Si': 28.0855, 'P': 30.973762, 'S': 32.065, 'Cl': 35.453, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, 'Sc': ...
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
__all__ = ('func', 'C') def func(): pass class C: pass
__all__ = ('func', 'C') def func(): pass class C: pass
DBPEDIA_URI = "http://dbpedia.org/sparql" # dsbox02.isi.edu # ELASTICSEARCH_URI "http://kg2018a.isi.edu:9200/my_wiki_content_first/_search" # SPARQL_URI = "http://dsbox02.isi.edu:8888/bigdata/namespace/wdq/sparql" # IDENTIFIER_WIKIFIER = "http://minds03.isi.edu:4444/get_properties" # DataMachines Nov 2019 ELASTICSEA...
dbpedia_uri = 'http://dbpedia.org/sparql' elasticsearch_uri = 'http://10.108.20.4:9200/my_wiki_content_first/_search' sparql_uri = 'http://10.108.20.4:9966/bigdata/namespace/wdq/sparql' identifier_wikifier = 'http://10.108.20.4:9000/get_properties'
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iter...
class Config(object): c_dim = 5 c2_dim = 8 celeba_crop_size = 178 rafd_crop_size = 256 image_size = 128 g_conv_dim = 64 d_conv_dim = 64 g_repeat_num = 6 d_repeat_num = 6 lambda_cls = 1 lambda_rec = 10 lambda_gp = 10 dataset = 'CelebA' batch_size = 16 num_iters...
li = input().split() dicti={} for i in li: if i not in dicti: dicti[i]=1 else: print(i)
li = input().split() dicti = {} for i in li: if i not in dicti: dicti[i] = 1 else: print(i)
formatter = "{} {} {} {}" #this gives 4 empty slots in the formatter variable print(formatter.format(1, 2, 3, 4)) #this fill the slots with 1234 print(formatter.format("one", "two", "three", "four")) #this fills the slots with one two three four print(formatter.format(True, False, False, True)) #this fills the slots w...
formatter = '{} {} {} {}' print(formatter.format(1, 2, 3, 4)) print(formatter.format('one', 'two', 'three', 'four')) print(formatter.format(True, False, False, True)) print(formatter.format(formatter, formatter, formatter, formatter)) print(formatter.format('Try your', 'Own text here', 'Maybe a poem', 'Or a song about ...
class LavadoraFacade(object): def lavar(self): self._lavar = Lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = Enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = Centrifugado() self._cent...
class Lavadorafacade(object): def lavar(self): self._lavar = lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = centrifugado() self._c...
#Given an array of integers, find and print the maximum number of integers you #can select from the array such that the absolute difference between any two of #the chosen integers is less than or equal to . For example, if your array is , #you can create two subarrays meeting the criterion: and . The maxim...
list = input().split() list = [int(i) for i in list] list.sort() print(list) def picking_numbers(list): maximum = [] maxim = 0 while len(list) > 1: if len(list) != 0: a = max(list) count_max = list.count(A) for j in range(count_max): list.remove(m...
# Python lists can be used as Arrays in Python # Creating an array things = ['pen', 'car', 'books'] print(things) # accessing the array element print(things[0]) # prints the first element of the array things # modifying the value of the array element things[1] = 'pencil' # second element of things, gets changed to ...
things = ['pen', 'car', 'books'] print(things) print(things[0]) things[1] = 'pencil' print(things[1]) length = len(things) print(length) for a in things: print(a) for i in range(len(things)): print(things[i])
def isDivisibleBy(int, divisor): return int % divisor == 0; def doFizzBuzz(): for i in range(1, 101): isDivisibleByThree = isDivisibleBy(i, 3) isDivisibleByFive = isDivisibleBy(i, 5) if (isDivisibleByThree and isDivisibleByFive): print('fizzbuzz') elif isDivisibleByThree: print('fizz') elif isD...
def is_divisible_by(int, divisor): return int % divisor == 0 def do_fizz_buzz(): for i in range(1, 101): is_divisible_by_three = is_divisible_by(i, 3) is_divisible_by_five = is_divisible_by(i, 5) if isDivisibleByThree and isDivisibleByFive: print('fizzbuzz') elif isD...
__all__ = ["analyze_traffic", "utils", "manage_resolutions", "url_regex_resolver", "get_popular_urls", "funnel_in_outs", "funnel_stats", "sankey_funnel", "frequent_funnel", "analyze_clicks", "analyze_timing"]
__all__ = ['analyze_traffic', 'utils', 'manage_resolutions', 'url_regex_resolver', 'get_popular_urls', 'funnel_in_outs', 'funnel_stats', 'sankey_funnel', 'frequent_funnel', 'analyze_clicks', 'analyze_timing']
# # PySNMP MIB module CISCO-FCIP-MGMT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-FCIP-MGMT-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:41:05 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, value_size_constraint, single_value_constraint, value_range_constraint) ...
class unionFindSet: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): x, y = sorted((self.find(a...
class Unionfindset: def __init__(self, S): self.S = {i: i for i in S} self.size = {i: 1 for i in S} def find(self, x): if x != self.S[x]: self.S[x] = self.find(self.S[x]) return self.S[x] def union(self, a, b, key=lambda x: x): (x, y) = sorted((self.fin...
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
registered = False api_key = None environment = None log_404 = False log_403 = False log_405 = False use_ssl = False
pytest_plugins = [ "polygon.tests.fixtures", "polygon.plugins.tests.fixtures", "polygon.graphql.tests.fixtures", ]
pytest_plugins = ['polygon.tests.fixtures', 'polygon.plugins.tests.fixtures', 'polygon.graphql.tests.fixtures']
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = loadImage("texture.jpg") obj = loadShape("man.obj") def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotateZ(PI) rotateY(ry) scale(25) # Orange point ...
ry = 0 def setup(): size(800, 800, P3D) global obj, texture1 texture1 = load_image('texture.jpg') obj = load_shape('man.obj') def draw(): global ry background(0) lights() translate(width / 2, height / 2 + 200, -200) rotate_z(PI) rotate_y(ry) scale(25) point_light(150, 1...
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
STX: bytes = b"\x02" # Start of text, indicates the start of a message. ETX: bytes = b"\x03" # End of text, indicates the end of a message ENQ: bytes = b"\x05" # Enquiry about the PC interface being ready to receive a new message. ACK: bytes = b"\x06" # Positive acknowledgement to a PMS message or enquiry (ENQ). NA...
stx: bytes = b'\x02' etx: bytes = b'\x03' enq: bytes = b'\x05' ack: bytes = b'\x06' nak: bytes = b'\x15' lrc_skip: bytes = b'\r' def lrc(message: bytes) -> bytes: result = 0 for b in message + ETX: result ^= b return bytes([result])
class Interval: def __init__(self, start, end): if start < end: self.start = start self.end = end else: self.start = end self.end = start def overlap(self, other): if self.start > other.start and self.start < other.end: return ...
class Interval: def __init__(self, start, end): if start < end: self.start = start self.end = end else: self.start = end self.end = start def overlap(self, other): if self.start > other.start and self.start < other.end: return...
# create a loop counter = 10 while counter > 0: print(counter) counter = counter -1 print('Blastoff!!')
counter = 10 while counter > 0: print(counter) counter = counter - 1 print('Blastoff!!')
# Hacer un programa que pida un caracter e indique si es una boca o no caracter = input("Digite un caracter: ").lower()# para mayusculas #caracter = caracter.lower() #caracter = caracter.upper() if caracter =="a" or caracter =="b" or caracter =="c" or caracter =="d" or caracter =="e": print("Es Una vocal") else: p...
caracter = input('Digite un caracter: ').lower() if caracter == 'a' or caracter == 'b' or caracter == 'c' or (caracter == 'd') or (caracter == 'e'): print('Es Una vocal') else: print('No es una vocal')
grocery_list = ["fish", "tomato", "apples"] # Create new list print("tomato" in grocery_list) # Check that grocery_list contains "tomato" item grocery_dict = {"fish": 1, "tomato": 6, "apples": 3} # create new dictionary print("fish" in grocery_dict)
grocery_list = ['fish', 'tomato', 'apples'] print('tomato' in grocery_list) grocery_dict = {'fish': 1, 'tomato': 6, 'apples': 3} print('fish' in grocery_dict)
def _impl(ctx): args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks] args_file = ctx.actions.declare_file(ctx.label.name + ".args") ctx.actions.write( output = args_file, content = "\n".join(args), ) ctx.actions.run( mnemonic = "Concat", inputs = ctx.f...
def _impl(ctx): args = [ctx.outputs.out.path] + [f.path for f in ctx.files.chunks] args_file = ctx.actions.declare_file(ctx.label.name + '.args') ctx.actions.write(output=args_file, content='\n'.join(args)) ctx.actions.run(mnemonic='Concat', inputs=ctx.files.chunks + [args_file], outputs=[ctx.outputs.ou...
k = int(input()) r = list(map(int, input().split())) p = set(r) # stores the sum of all unique elements x total no of groups a = sum(p)*k # stores the sum of element in the list b = sum(r) # (a - b) = (k - 1)*captains_room_no # prints the the difference of a and b divided by k-1 print((a-b)//(k-1))
k = int(input()) r = list(map(int, input().split())) p = set(r) a = sum(p) * k b = sum(r) print((a - b) // (k - 1))
def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def selectionSort(arr): for i in range(len(arr)): smallest = arr[i] for j in range(i+1, len(arr)): print(i) if smallest > arr[j]: print(f"replacing {j} th position with {i}th pos...
def swap(arr, i, j): temp = arr[i] arr[i] = arr[j] arr[j] = temp def selection_sort(arr): for i in range(len(arr)): smallest = arr[i] for j in range(i + 1, len(arr)): print(i) if smallest > arr[j]: print(f'replacing {j} th position with {i}th posi...
with open('input.txt', 'r') as reader: input = [line for line in reader.read().splitlines()] def part1(numbers): length = len(numbers[0]) sums = [0] * length for number in numbers: for i in range(length): sums[i] += int(number[i]) gamma = [1 if v > len(numbers) / 2 else 0 for v i...
with open('input.txt', 'r') as reader: input = [line for line in reader.read().splitlines()] def part1(numbers): length = len(numbers[0]) sums = [0] * length for number in numbers: for i in range(length): sums[i] += int(number[i]) gamma = [1 if v > len(numbers) / 2 else 0 for v ...
def sieve(n): checkArray = [1] * (n+1) checkArray[0] = 0 checkArray[1] = 0 for i in range(2,n+1): j = i + i step = j + i for j in range(j,n+1,i): checkArray[j] = 0 for i in range(0,n+1): if checkArray[i] != 0: print(i) if __name__ == "__main__": n = int(input()) sieve(n)
def sieve(n): check_array = [1] * (n + 1) checkArray[0] = 0 checkArray[1] = 0 for i in range(2, n + 1): j = i + i step = j + i for j in range(j, n + 1, i): checkArray[j] = 0 for i in range(0, n + 1): if checkArray[i] != 0: print(i) if __name__ ...
#Printing 'reverse Pyramid Shape ! ''' * * * * * * * * * * * * * * * ''' n=int(input()) for i in range(n,0,-1): #for rows for j in range(0,n-i): # for space print(end=' ') for j in range(0,i): # creating star print("*",end=' ') print() #other method n=int(input()) for i in range(n,...
""" * * * * * * * * * * * * * * * """ n = int(input()) for i in range(n, 0, -1): for j in range(0, n - i): print(end=' ') for j in range(0, i): print('*', end=' ') print() n = int(input()) for i in range(n, 0, -1): print(' ' * (n - i) + '* ' * i)
class StepParseError(Exception): pass class RatDisconnectedError(Exception): pass class InvalidTimeoutExceptionError(Exception): pass class RatCallbackTimeoutError(Exception): pass class MissingFileError(Exception): pass
class Stepparseerror(Exception): pass class Ratdisconnectederror(Exception): pass class Invalidtimeoutexceptionerror(Exception): pass class Ratcallbacktimeouterror(Exception): pass class Missingfileerror(Exception): pass
def max_of_maximums(dTEmax, dsRNAmax): print('Finding max of maximums') dmax = {} for i in list(dTEmax.keys()): for j in list(dsRNAmax.keys()): try: dTEmax[j] except: dmax[j] = dsRNAmax[j] else: dmax[j] = max(dTEmax[...
def max_of_maximums(dTEmax, dsRNAmax): print('Finding max of maximums') dmax = {} for i in list(dTEmax.keys()): for j in list(dsRNAmax.keys()): try: dTEmax[j] except: dmax[j] = dsRNAmax[j] else: dmax[j] = max(dTEmax[...
# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. # See LICENSE in the project root for license information. # Client ID and secret. client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
registry = { "centivize_service": { "grpc": 7003, }, }
registry = {'centivize_service': {'grpc': 7003}}
''' additional_datastructures.py: File containing custom utility data structures for use in simple_rl. ''' class SimpleRLStack(object): ''' Implementation for a basic Stack data structure ''' def __init__(self, _list=None): ''' Args: _list (list) : underlying elements in the stack ...
""" additional_datastructures.py: File containing custom utility data structures for use in simple_rl. """ class Simplerlstack(object): """ Implementation for a basic Stack data structure """ def __init__(self, _list=None): """ Args: _list (list) : underlying elements in the stack ...
# RUN: llvmPy %s > %t1 # RUN: cat -n %t1 >&2 # RUN: cat %t1 | FileCheck %s print(1 * 2) # CHECK: 2 print(2 * 2) # CHECK-NEXT: 4 print(0 * 2) # CHECK-NEXT: 0
print(1 * 2) print(2 * 2) print(0 * 2)
# 1st solution class Solution: def nthMagicalNumber(self, n: int, a: int, b: int) -> int: g = self.gcd(a, b) largest = a // g * b lst = [] numOne, numTwo = a, b while numOne <= largest and numTwo <= largest: if numOne < numTwo: lst.append(numOne) ...
class Solution: def nth_magical_number(self, n: int, a: int, b: int) -> int: g = self.gcd(a, b) largest = a // g * b lst = [] (num_one, num_two) = (a, b) while numOne <= largest and numTwo <= largest: if numOne < numTwo: lst.append(numOne) ...