content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
for value in range(10): print(value) print('All Done!')
for value in range(10): print(value) print('All Done!')
def shift_letter(char, shifts): if not isinstance(char, chr): raise ValueError('char should be typeof chr') if char == '' or char is None: raise ValueError('char should be typeof chr') if ord(char.upper()) < 65 or ord(char.upper()) > 90: raise ValueError('char should be only a-z Lati...
def shift_letter(char, shifts): if not isinstance(char, chr): raise value_error('char should be typeof chr') if char == '' or char is None: raise value_error('char should be typeof chr') if ord(char.upper()) < 65 or ord(char.upper()) > 90: raise value_error('char should be only a-z L...
i = 1 while i < 20: print(i) i += 1 i = 1 while i < 100: print(i) i += 1 i = 50 while i < 60: print(i) i += 1 i = 5 while i < 60: print(i) i += 1 i = 1 while i < 6: print(i) if (i == 3): break i += 1 k = 1 while k < 20: print(k) ...
i = 1 while i < 20: print(i) i += 1 i = 1 while i < 100: print(i) i += 1 i = 50 while i < 60: print(i) i += 1 i = 5 while i < 60: print(i) i += 1 i = 1 while i < 6: print(i) if i == 3: break i += 1 k = 1 while k < 20: print(k) if k == 20 or k =...
def count_words(message): #return len(message.split()) # words = [] count = 0 activeWord = False for c in message: if c.isspace(): activeWord = False else: if not activeWord: # words.append([]) count += 1 activeW...
def count_words(message): count = 0 active_word = False for c in message: if c.isspace(): active_word = False elif not activeWord: count += 1 active_word = True return count def main(): message = 'What is your name?' print(message) print(c...
class BufferFullException(Exception): def __init__(self, msg): self.msg = msg class BufferEmptyException(Exception): def __init__(self, msg): self.msg = msg class CircularBuffer: def __init__(self, capacity): self.list_circulator = list() self.list_circulator.append(','.jo...
class Bufferfullexception(Exception): def __init__(self, msg): self.msg = msg class Bufferemptyexception(Exception): def __init__(self, msg): self.msg = msg class Circularbuffer: def __init__(self, capacity): self.list_circulator = list() self.list_circulator.append(','....
DOMAIN = "microsoft_todo" CONF_CLIENT_ID = "client_id" CONF_CLIENT_SECRET = "client_secret" AUTH_CALLBACK_PATH = "/api/microsoft-todo" AUTHORIZATION_BASE_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize" TOKEN_URL = "https://login.microsoftonline.com/common/oauth2/v2.0/token" SCOPE = ["Tasks.ReadW...
domain = 'microsoft_todo' conf_client_id = 'client_id' conf_client_secret = 'client_secret' auth_callback_path = '/api/microsoft-todo' authorization_base_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' token_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/token' scope = ['Tasks.ReadWr...
def parse_response_from_json(r): response = '' try: response = r.json()['response'] except Exception as ex: response = str(ex) return response
def parse_response_from_json(r): response = '' try: response = r.json()['response'] except Exception as ex: response = str(ex) return response
# [Commerci Republic] Delfino Deleter 2 sm.setSpeakerID(9390256) # Leon Daniella sm.sendNext("I was so much faster than you! But you're the sidekick for a reason.") sm.sendNext("C'mon! We can't let them get their buddies. We have to finish this now! I'll be waiting for you at #m865020200#") # Canal 3 sm.sendNext("Wh...
sm.setSpeakerID(9390256) sm.sendNext("I was so much faster than you! But you're the sidekick for a reason.") sm.sendNext("C'mon! We can't let them get their buddies. We have to finish this now! I'll be waiting for you at #m865020200#") sm.sendNext('What are you waiting for, my loyal sidekick?') sm.setPlayerAsSpeaker() ...
ans=0 n=200 def f(n): fac=[0]*(n+10) fac[0]=1 for i in range(1,n+5): fac[i]=i*fac[i-1] return fac def c(n,m): return fac[n]//fac[n-m]//fac[m] def solve(i,asn,b,other): res=0 if i>b: if other>b+1: return 0 else: t=fac[b+1]//fac[b+1-other] for j in asn: if j: t//=fac[j] return t for j i...
ans = 0 n = 200 def f(n): fac = [0] * (n + 10) fac[0] = 1 for i in range(1, n + 5): fac[i] = i * fac[i - 1] return fac def c(n, m): return fac[n] // fac[n - m] // fac[m] def solve(i, asn, b, other): res = 0 if i > b: if other > b + 1: return 0 else: ...
a='ala ma kota' print(a) a=u'ala ma kota' print(a) a='ala'+'ma'+'kota' print(a) print(len(a)) if(a[:1]=='a'): print(a[-4]) else: print('No nie za brdzo') print('{0}, {1}, {2}'.format(*'abc')) a = 'Psa' print('%s ma %s' % (a,a))
a = 'ala ma kota' print(a) a = u'ala ma kota' print(a) a = 'ala' + 'ma' + 'kota' print(a) print(len(a)) if a[:1] == 'a': print(a[-4]) else: print('No nie za brdzo') print('{0}, {1}, {2}'.format(*'abc')) a = 'Psa' print('%s ma %s' % (a, a))
scan_utility_version = '1.0.11' detect_jar = "/tmp/synopsys-detect.jar" # workflow_script = "/Users/mbrad/working/blackduck-scan-action/blackduck-rapid-scan-to-github.py" # detect_jar = "./synopsys-detect.jar" # workflow_script = "/Users/jcroall/PycharmProjects/blackduck-scan-action/blackduck-rapid-scan-to-github.py" d...
scan_utility_version = '1.0.11' detect_jar = '/tmp/synopsys-detect.jar' debug = 0 bd = None args = None scm_provider = None pkg_files = ['pom.xml', 'package.json', 'npm-shrinkwrap.json', 'package-lock.json', 'Cargo.toml', 'Cargo.lock', 'conanfile.txt', 'environment.yml', 'pubspec.yml', 'pubspec.lock', 'gogradle.lock', ...
destination = input() current_money = 0 while destination != 'End': vacation_money = float(input()) while current_money < vacation_money: work_money = float(input()) current_money += work_money print(f'Going to {destination}!') current_money = 0 destination = input()
destination = input() current_money = 0 while destination != 'End': vacation_money = float(input()) while current_money < vacation_money: work_money = float(input()) current_money += work_money print(f'Going to {destination}!') current_money = 0 destination = input()
class Book: def __init__(self, title, bookType): self.title = title self.bookType = bookType
class Book: def __init__(self, title, bookType): self.title = title self.bookType = bookType
XK_Aogonek = 0x1a1 XK_breve = 0x1a2 XK_Lstroke = 0x1a3 XK_Lcaron = 0x1a5 XK_Sacute = 0x1a6 XK_Scaron = 0x1a9 XK_Scedilla = 0x1aa XK_Tcaron = 0x1ab XK_Zacute = 0x1ac XK_Zcaron = 0x1ae XK_Zabovedot = 0x1af XK_aogonek = 0x1b1 XK_ogonek = 0x1b2 XK_lstroke = 0x1b3 XK_lcaron = 0x1b5 XK_sacute = 0x1b6 XK_caron...
xk__aogonek = 417 xk_breve = 418 xk__lstroke = 419 xk__lcaron = 421 xk__sacute = 422 xk__scaron = 425 xk__scedilla = 426 xk__tcaron = 427 xk__zacute = 428 xk__zcaron = 430 xk__zabovedot = 431 xk_aogonek = 433 xk_ogonek = 434 xk_lstroke = 435 xk_lcaron = 437 xk_sacute = 438 xk_caron = 439 xk_scaron = 441 xk_scedilla = 4...
def EDFB(U): if U>1: return False else: return True def SC_EDF(tasks): U=0 for itask in tasks: U+=(itask['execution']+itask['sslength'])/itask['period'] return EDFB(U)
def edfb(U): if U > 1: return False else: return True def sc_edf(tasks): u = 0 for itask in tasks: u += (itask['execution'] + itask['sslength']) / itask['period'] return edfb(U)
#buffer = [0xB5, 0x62, 0x06, 0x00, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0x80, 0x25, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00] #buffer = [0xB5, 0x62, 0x06, 0x09, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] #buffer = [0xB5, 0x62, 0x06, 0x3B,...
buffer = [181, 98, 5, 1, 2, 0, 6, 0] ca = 0 cb = 0 for x in range(2, len(buffer)): ca = 255 & ca + buffer[x] cb = 255 & cb + ca print(hex(ca)) print(hex(cb))
ifXTable = '.1.3.6.1.2.1.31.1.1.1' ifName = ifXTable + '.1' ifInMulticastPkts = ifXTable + '.2' ifHCInOctets = ifXTable + '.6' ifHCInUcastPkts = ifXTable + '.7' ifHCInMulticastPkts = ifXTable + '.8' ifHCInBroadcastPkts = ifXTable + '.9' ifHCOutOctets = ifXTable + '.10' ifHCOutUcastPkts = ifXTable + '.11' ifHCOutMultica...
if_x_table = '.1.3.6.1.2.1.31.1.1.1' if_name = ifXTable + '.1' if_in_multicast_pkts = ifXTable + '.2' if_hc_in_octets = ifXTable + '.6' if_hc_in_ucast_pkts = ifXTable + '.7' if_hc_in_multicast_pkts = ifXTable + '.8' if_hc_in_broadcast_pkts = ifXTable + '.9' if_hc_out_octets = ifXTable + '.10' if_hc_out_ucast_pkts = ifX...
# from django.views.generic.base import View # from rest_framework.views import APIView # from django.conf import settings #!/usr/bin/env python # def func(): # fun_list = [] # for i in range(4): # def foo(x, i=i): # return x*i # fun_list.append(foo) # return fun_list # # # for...
class Singletool(object): __instance = None def __new__(cls, *args, **kwargs): if not cls.__instance: cls.__instance = object.__new__(cls) return cls.__instance def addxnum(self, *args): my_sum = 0 for value in args: my_sum += value return my...
# modifying a list in a function # Start with some designs that need to be printed. unprinted_designs = ['phone case', 'robot pendant', 'dodecahedron'] completed_models = [] # Simulate printing each design, until none are left. # Move each design to completed_models after printing. while unprinted_designs: curren...
unprinted_designs = ['phone case', 'robot pendant', 'dodecahedron'] completed_models = [] while unprinted_designs: current_design = unprinted_designs.pop() print(f'Printing model: {current_design}') completed_models.append(current_design) print('\nThe following models have been printed:') for completed_mode...
def foo(): x = 1 def bar(): nonlocal x baz() print(x) def baz(): nonlocal x x = 2 bar() foo()
def foo(): x = 1 def bar(): nonlocal x baz() print(x) def baz(): nonlocal x x = 2 bar() foo()
class MovieData: def __init__(self,movie_name,imdb_id,plot,review,facts_table,comments,spans,labels,chat,chat_id): self.movie_name=movie_name self.imdb_id=imdb_id self.plot=plot self.review=review self.facts_table=facts_table self.comments=comments s...
class Moviedata: def __init__(self, movie_name, imdb_id, plot, review, facts_table, comments, spans, labels, chat, chat_id): self.movie_name = movie_name self.imdb_id = imdb_id self.plot = plot self.review = review self.facts_table = facts_table self.comments = comme...
# Tests: # ifstmt ::= testexpr _ifstmts_jump # _ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM if True: b = False
if True: b = False
class Solution: def checkEqualTree(self, root: Optional[TreeNode]) -> bool: if not root: return False seen = set() def dfs(root: Optional[TreeNode]) -> int: if not root: return 0 sum = root.val + dfs(root.left) + dfs(root.right) seen.add(sum) return sum sum = ...
class Solution: def check_equal_tree(self, root: Optional[TreeNode]) -> bool: if not root: return False seen = set() def dfs(root: Optional[TreeNode]) -> int: if not root: return 0 sum = root.val + dfs(root.left) + dfs(root.right) ...
# color references: # http://rebrickable.com/colors # http://www.bricklink.com/catalogColors.asp rebrickable_color_to_bricklink = { # Solid Colors 15: (1, 'White'), 503: (49, 'Very Light Gray'), 151: (99, 'Very Light Bluish Gray'), 71: (86, 'Light Bluish Gray'), 7: (9, 'Light Gray'), 8: (10, 'Dark Gray'), ...
rebrickable_color_to_bricklink = {15: (1, 'White'), 503: (49, 'Very Light Gray'), 151: (99, 'Very Light Bluish Gray'), 71: (86, 'Light Bluish Gray'), 7: (9, 'Light Gray'), 8: (10, 'Dark Gray'), 72: (85, 'Dark Bluish Gray'), 0: (11, 'Black'), 320: (59, 'Dark Red'), 4: (5, 'Red'), 216: (27, 'Rust'), 12: (25, 'Salmon'), 1...
def get_gender(sex='unknown'): if sex == 'm': sex = 'male' elif sex == 'f': sex = 'female' print(sex) get_gender('m') get_gender('f') get_gender()
def get_gender(sex='unknown'): if sex == 'm': sex = 'male' elif sex == 'f': sex = 'female' print(sex) get_gender('m') get_gender('f') get_gender()
description = 'Example Sans2D Pixel Detector Setup with Instrument View' group = 'basic' sysconfig = dict( instrument = 'sans2d', ) devices = dict( sans2d = device('nicos_demo.mantid.devices.instrument.ViewableInstrument', description = 'instrument object', responsible = 'R. Esponsible <r.esp...
description = 'Example Sans2D Pixel Detector Setup with Instrument View' group = 'basic' sysconfig = dict(instrument='sans2d') devices = dict(sans2d=device('nicos_demo.mantid.devices.instrument.ViewableInstrument', description='instrument object', responsible='R. Esponsible <r.esponsible@stfc.ac.uk>', instrument='sans2...
class Student: def __init__(self,name="",roll=2): print("para init called") self.name=name self.roll_no=roll def hello(self): print("Hello this is: ",self.name) print("Your roll no. is: ",self.roll_no)
class Student: def __init__(self, name='', roll=2): print('para init called') self.name = name self.roll_no = roll def hello(self): print('Hello this is: ', self.name) print('Your roll no. is: ', self.roll_no)
description = 'pressure filter readout' group = 'lowlevel' devices = dict( # p_in_filter = device('nicos_mlz.sans1.devices.wut.WutValue', # hostname = 'sans1wut-p-diff-fak40.sans1.frm2', # port = '1', # description = 'pressure in front of filter', # fmtstr = '%.2F', # logle...
description = 'pressure filter readout' group = 'lowlevel' devices = dict()
#Python doesn't support Generics #you can do it like this in java or C++ or #any other Object Oriented language which supports Generics class AdvancedArithmetic(object): def divisorSum(n): raise NotImplementedError class Calculator(AdvancedArithmetic): def divisorSum(self, n): di...
class Advancedarithmetic(object): def divisor_sum(n): raise NotImplementedError class Calculator(AdvancedArithmetic): def divisor_sum(self, n): divisor = [] for i in range(n): x = len([i for i in range(1, n + 1) if n % i]) divisor.append(x) res = sum(di...
class Solution: def solve(self, nums, k): history = [nums[:]] seen = {tuple(nums)} before_cycle = [] cycle = [] while True: nums2 = [0]*8 for i in range(1,7): l = (nums[i-1] if i-1 >= 0 else 0) + (nums[i+1] if i+1 < 8 else 0) ...
class Solution: def solve(self, nums, k): history = [nums[:]] seen = {tuple(nums)} before_cycle = [] cycle = [] while True: nums2 = [0] * 8 for i in range(1, 7): l = (nums[i - 1] if i - 1 >= 0 else 0) + (nums[i + 1] if i + 1 < 8 else 0...
expected_output = { "Tunnel10": { "bandwidth": 100, "counters": { "in_abort": 0, "in_broadcast_pkts": 0, "in_crc_errors": 0, "in_errors": 0, "in_frame": 0, "in_giants": 0, "in_ignored": 0, "in_multicast_p...
expected_output = {'Tunnel10': {'bandwidth': 100, 'counters': {'in_abort': 0, 'in_broadcast_pkts': 0, 'in_crc_errors': 0, 'in_errors': 0, 'in_frame': 0, 'in_giants': 0, 'in_ignored': 0, 'in_multicast_pkts': 0, 'in_no_buffer': 0, 'in_octets': 0, 'in_overrun': 0, 'in_pkts': 0, 'in_runts': 0, 'in_throttles': 0, 'last_clea...
input = open('input.txt'); length = int(input.readline()); tokens = input.readline().split(' '); input.close(); output = open('output.txt' , 'w'); i = 0; while i < length: j = 0; while (int(tokens[i]) >= int(tokens[j])) & (j < i): j += 1; if j < i: shelf = tokens[i]; k = i; w...
input = open('input.txt') length = int(input.readline()) tokens = input.readline().split(' ') input.close() output = open('output.txt', 'w') i = 0 while i < length: j = 0 while (int(tokens[i]) >= int(tokens[j])) & (j < i): j += 1 if j < i: shelf = tokens[i] k = i while k > j:...
expected_output = { "ospf-database-information": { "ospf-area-header": {"ospf-area": "192.168.76.0"}, "ospf-database": { "@heading": "Type ID Adv Rtr Seq Age Opt Cksum Len", "advertising-router": "192.168.219.235", "age": "173...
expected_output = {'ospf-database-information': {'ospf-area-header': {'ospf-area': '192.168.76.0'}, 'ospf-database': {'@heading': 'Type ID Adv Rtr Seq Age Opt Cksum Len', 'advertising-router': '192.168.219.235', 'age': '1730', 'checksum': '0x1b56', 'lsa-id': '10.69.197.1', 'lsa-len...
while True: h = int(input()) if h == 0: break arr = list() arr.append(h) while h != 1: if h%2 == 0: h = int((0.5)*h) arr.append(h) else: h = 3 * h + 1 arr.append(h) # print(arr) print(max(arr))
while True: h = int(input()) if h == 0: break arr = list() arr.append(h) while h != 1: if h % 2 == 0: h = int(0.5 * h) arr.append(h) else: h = 3 * h + 1 arr.append(h) print(max(arr))
def read_input(): row, col = [int(x) for x in input().split()] arr = [list(input()) for _ in range(row)] return arr def print_output(obj): for i in obj: print(''.join(i)) def test_pos(obj, grid, row, col): for i in range(len(obj)): for j in range(len(obj[0])): if grid...
def read_input(): (row, col) = [int(x) for x in input().split()] arr = [list(input()) for _ in range(row)] return arr def print_output(obj): for i in obj: print(''.join(i)) def test_pos(obj, grid, row, col): for i in range(len(obj)): for j in range(len(obj[0])): if grid...
# import pytest class TestSingletonMeta: def test___call__(self): # synced assert True class TestSingleton: pass
class Testsingletonmeta: def test___call__(self): assert True class Testsingleton: pass
i = 0 result = 0 while i <= 100: if i % 2 == 0: result += i i += 1 print(result) j = 0 result2 = 0 while j <= 100: result2 += j j += 2 print(result2)
i = 0 result = 0 while i <= 100: if i % 2 == 0: result += i i += 1 print(result) j = 0 result2 = 0 while j <= 100: result2 += j j += 2 print(result2)
# test for PR#112 -- functions should not have __module__ attributes def f(): pass if hasattr(f, '__module__'): print('functions should not have __module__ attributes') # but make sure classes still do have __module__ attributes class F: pass if not hasattr(F, '__module__'): print('classes should st...
def f(): pass if hasattr(f, '__module__'): print('functions should not have __module__ attributes') class F: pass if not hasattr(F, '__module__'): print('classes should still have __module__ attributes')
# kano00 # https://adventofcode.com/2021/day/10 def calc1(chunk_list): left_brankets = ["(", "[", "{", "<"] right_brankets = [")", "]", "}", ">"] scores = [3,57,1197,25137] res = 0 def calc_points(chunk): stack = [] for c in chunk: for i in range(4): if ...
def calc1(chunk_list): left_brankets = ['(', '[', '{', '<'] right_brankets = [')', ']', '}', '>'] scores = [3, 57, 1197, 25137] res = 0 def calc_points(chunk): stack = [] for c in chunk: for i in range(4): if c == left_brankets[i]: sta...
#!/usr/bin/python li = [1, 2, 3, 1, 4, 5] # wrong 1 for v in li: if v == 1 or v == 2: li.remove(v) # wrong 2 for idx, v in enumerate(li): if v == 1 or v == 2: del li[idx] # wrong 3 for idx, v in enumerate(li[:]): if v == 1 or v == 2: del li[idx] # not recommend for v in li[:]: ...
li = [1, 2, 3, 1, 4, 5] for v in li: if v == 1 or v == 2: li.remove(v) for (idx, v) in enumerate(li): if v == 1 or v == 2: del li[idx] for (idx, v) in enumerate(li[:]): if v == 1 or v == 2: del li[idx] for v in li[:]: if v == 1 or v == 2: li.remove(v) li = list(filter(lam...
largest = None smallest = None numbers = list() while True: num = input('Enter a number: ') if num == "done": if numbers == []: max = '(no input)' min = '(no input)' else: max = max(numbers) min = min(numbers) break try: num ...
largest = None smallest = None numbers = list() while True: num = input('Enter a number: ') if num == 'done': if numbers == []: max = '(no input)' min = '(no input)' else: max = max(numbers) min = min(numbers) break try: num = i...
# Iterable Data # - String # - List # - Set # - Dictionary for x in [3,5,2]: print(x) for x in "abc": print(x) for x in {"x":"123", "a":"456"}: print(x) ########## # max(iterable data) # sorted (iterable data) result=max([30, 20, 50, 10]) print(result) result2=sorted([30, 20, 50, 10]) print(result2)
for x in [3, 5, 2]: print(x) for x in 'abc': print(x) for x in {'x': '123', 'a': '456'}: print(x) result = max([30, 20, 50, 10]) print(result) result2 = sorted([30, 20, 50, 10]) print(result2)
print(population/area) # De indices worden gebruitk om te achterhalen welke elementen bij elkaar horen. # Strings kun je gewoon optellen! df1 = make_df(list('AB'), range(2)) # print(df1) df2 = make_df(list('ACB'), range(3)) # print(df2) print(df1+df2) # Alleen overeenkomstige kolommen zijn gebruikt, en de volgorde va...
print(population / area) df1 = make_df(list('AB'), range(2)) df2 = make_df(list('ACB'), range(3)) print(df1 + df2) print() df1 = make_df('AB', [1, 2]) df2 = make_df('AB', [3, 4]) print(pd.concat([df1, df2])) print() print(pd.concat([df1, df2], axis=1)) print() df3 = make_df('AB', [1, 3]) print(pd.concat([df1, df3])) pr...
n = int(input()) dot = (2 ** n) + 1 result = dot * dot print(result)
n = int(input()) dot = 2 ** n + 1 result = dot * dot print(result)
var1 = "Hello " var2 = "World" # + Operator is used to combine strings var3 = var1 + var2 print(var3)
var1 = 'Hello ' var2 = 'World' var3 = var1 + var2 print(var3)
#x = 3 #x = x*x #print(x) #y = input('enter a number:') #print(y) #x = int(input('Enter an integer')) #if x%2 == 0: # print('Even') #else: # print('Odd') # if x%3 != 0: # print('And not divisible by 3') #Find the cube root of a perfect cube #x = int(input('Enter an integer')) #ans = 0 #while ans*ans*an...
for i in range(1, 101): s = str(i) if i % 3 == 0 or i % 5 == 0: s = '' if i % 3 == 0: s = s + 'Fizz' if i % 5 == 0: s = s + 'Buzz' print(s)
class Order: def __init__(self, orderInfo): self.order_id = orderInfo[0] self.customer_id =int(orderInfo[1]) self.order_date = orderInfo[2] self.status = orderInfo[3] self.total_price = float(orderInfo[4]) self.comment = orderInfo[5]
class Order: def __init__(self, orderInfo): self.order_id = orderInfo[0] self.customer_id = int(orderInfo[1]) self.order_date = orderInfo[2] self.status = orderInfo[3] self.total_price = float(orderInfo[4]) self.comment = orderInfo[5]
# # PySNMP MIB module Unisphere-Data-Registry (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-Registry # Produced by pysmi-0.3.4 at Wed May 1 15:31:00 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_size_constraint, single_value_constraint, constraints_union, value_range_constraint) ...
# el binary searc solo sirve con una lista ordenada def run(): sequence = [1,2,3,4,5,6,7,8,9,10,11] print(binary_search(sequence,-5)) def binary_search(list,goal,start=None,end=None): if start is None: start = 0 if end is None: end = len(list)-1 midpoint = (start + end)...
def run(): sequence = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] print(binary_search(sequence, -5)) def binary_search(list, goal, start=None, end=None): if start is None: start = 0 if end is None: end = len(list) - 1 midpoint = (start + end) // 2 if end < start: return -1 e...
# Func11.py def calc(n,m): return [n+m, n-m, n*m, n/m] print(calc(20, 10)) a,b,c,d = calc(20,10) print(a,b,c,d) # + - * / def swap(n,m): return m, n x= 200 y= 100 x,y = swap(x,y) print(x,y) # 100, 200
def calc(n, m): return [n + m, n - m, n * m, n / m] print(calc(20, 10)) (a, b, c, d) = calc(20, 10) print(a, b, c, d) def swap(n, m): return (m, n) x = 200 y = 100 (x, y) = swap(x, y) print(x, y)
class Source: def __init__(self,id,name): self.id = id self.name = name class Articles: def __init__(self, publishedAt, urlToImage,title,content,author,url): self.publishedAt = publishedAt self.urlToImage= urlToImage self.title = title self.content =content self.author...
class Source: def __init__(self, id, name): self.id = id self.name = name class Articles: def __init__(self, publishedAt, urlToImage, title, content, author, url): self.publishedAt = publishedAt self.urlToImage = urlToImage self.title = title self.content = con...
# from 1.0.0 data1 = { 'fs': { 'nn::fssrv::sf::IFileSystemProxyForLoader': { 0: {"inbytes": 0, "outbytes": 0, "buffers": [25], "outinterfaces": ['nn::fssrv::sf::IFileSystem']}, 1: {"inbytes": 8, "outbytes": 1}, }, 'nn::fssrv::sf::IEventNotifier': { 0: {"inbytes": ...
data1 = {'fs': {'nn::fssrv::sf::IFileSystemProxyForLoader': {0: {'inbytes': 0, 'outbytes': 0, 'buffers': [25], 'outinterfaces': ['nn::fssrv::sf::IFileSystem']}, 1: {'inbytes': 8, 'outbytes': 1}}, 'nn::fssrv::sf::IEventNotifier': {0: {'inbytes': 0, 'outbytes': 0, 'outhandles': [1]}}, 'nn::fssrv::sf::IFileSystemProxy': {...
def median(list): center_value = len(list) // 2 return list[center_value] def sort_list(list_to_order): while True: changed = False for index, value in enumerate(list_to_order): if not(index + 1 == len(list_to_order)): if value > list_to_order[index + 1]: ...
def median(list): center_value = len(list) // 2 return list[center_value] def sort_list(list_to_order): while True: changed = False for (index, value) in enumerate(list_to_order): if not index + 1 == len(list_to_order): if value > list_to_order[index + 1]: ...
def soma(var1, var2): var = var1 +var2 return var def subtracao(var1, var2): var =var1 - var2 return var def multiplicacao(var1, var2): var =var1 * var2 return var def divisao(var1, var2): var =var1/var2 return var
def soma(var1, var2): var = var1 + var2 return var def subtracao(var1, var2): var = var1 - var2 return var def multiplicacao(var1, var2): var = var1 * var2 return var def divisao(var1, var2): var = var1 / var2 return var
class Settings: def __init__(self): pass # default settings master_title = 'Mr.' master_name = 'John' master_surname = 'Doe' master_gender = 'female' master_formal_address = 'sir' master_email_username = None master_email_password = None jarvis_name = 'jarvis' ja...
class Settings: def __init__(self): pass master_title = 'Mr.' master_name = 'John' master_surname = 'Doe' master_gender = 'female' master_formal_address = 'sir' master_email_username = None master_email_password = None jarvis_name = 'jarvis' jarvis_gender = 'female' ...
# Created by MechAviv # NPC ID :: 9131007 # Takeda Shingen if sm.getFieldID() == 807100000: sm.setSpeakerID(9131007) sm.sendNext("Get to the Honnou-ji Outer Wall and open the Eastern Door.") elif sm.getFieldID() == 807100001: # Honnou-ji Eastern Grounds sm.startQuest(57101) # Unhandled Field Effect [O...
if sm.getFieldID() == 807100000: sm.setSpeakerID(9131007) sm.sendNext('Get to the Honnou-ji Outer Wall and open the Eastern Door.') elif sm.getFieldID() == 807100001: sm.startQuest(57101) sm.setIntroBoxChat(9131007) sm.sendNext("You did all right, samurai. I'll let you join my side for now.") sm...
a,b,c=map(int,input().split()) e=180 d=a+b+c if(e==d): print("yes") else: print("no")
(a, b, c) = map(int, input().split()) e = 180 d = a + b + c if e == d: print('yes') else: print('no')
# https://www.hackerrank.com/challenges/encryption/problem def encryption(s): n = len(s) r, c = math.floor(math.sqrt(n)), math.ceil(math.sqrt(n)) if r*c<n: r+=1 res =[] for i in range(c): temp = [] j = 0 while i+j<n: temp.append(s[i+j]) j...
def encryption(s): n = len(s) (r, c) = (math.floor(math.sqrt(n)), math.ceil(math.sqrt(n))) if r * c < n: r += 1 res = [] for i in range(c): temp = [] j = 0 while i + j < n: temp.append(s[i + j]) j += c res.append(''.join(temp)) prin...
#!/user/bin/env python '''rFree.py: This filter returns true if the rFree value for this structure is within the specified range References ---------- - `rFree <http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/r-value-and-r-free>`_ ''' __author__ = "Mars (Shih-Cheng) Huang" __maintainer__ = "Mars (Shih-C...
"""rFree.py: This filter returns true if the rFree value for this structure is within the specified range References ---------- - `rFree <http://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/r-value-and-r-free>`_ """ __author__ = 'Mars (Shih-Cheng) Huang' __maintainer__ = 'Mars (Shih-Cheng) Huang' __email__ ...
# Declare some constants and variables WIDTH, HEIGHT = (600, 400) FPS = 60 BLACK = "#000000" DARKGRAY = "#404040" GRAY = "#808080" LIGHTGRAY = "#d3d3d3" WHITE = "#FFFFFF" ORANGE = "#FF6600" RED = "#FF1F00" PURPLE = "#800080" DARKPURPLE = "#301934"
(width, height) = (600, 400) fps = 60 black = '#000000' darkgray = '#404040' gray = '#808080' lightgray = '#d3d3d3' white = '#FFFFFF' orange = '#FF6600' red = '#FF1F00' purple = '#800080' darkpurple = '#301934'
def generate_log(logs): logs.create('test', '123', '0.0.0.0', 'os', '1.0.0', 'browser', '1.0.0', 'continent', 'country', 'country_emoji', 'region', 'city') def test_logs(logs): test_logs_log(logs) test_reset(logs) test_clean(logs) def test_logs_log(logs): generate_l...
def generate_log(logs): logs.create('test', '123', '0.0.0.0', 'os', '1.0.0', 'browser', '1.0.0', 'continent', 'country', 'country_emoji', 'region', 'city') def test_logs(logs): test_logs_log(logs) test_reset(logs) test_clean(logs) def test_logs_log(logs): generate_log(logs) assert len(logs.get...
first_number = int(input("Enter the first number: ")) second_number = int(input("Enter the second number: ")) operation = input("Choose operation(+, -, *, /, %): ") result = 0 if operation == "+" or operation == "-" or operation == "*": if operation == "+": result = first_number + second_number elif op...
first_number = int(input('Enter the first number: ')) second_number = int(input('Enter the second number: ')) operation = input('Choose operation(+, -, *, /, %): ') result = 0 if operation == '+' or operation == '-' or operation == '*': if operation == '+': result = first_number + second_number elif ope...
WORD_VEC_SIZE = 256 # Suggest: 300 MAX_LENGTH = 8 ENDING_MARK = "<e>" LSTM_UNIT = 64 # Suggest: 512 ATTENTION_UNIT = 1 # Suggest: 128??? EPOCHS = 400
word_vec_size = 256 max_length = 8 ending_mark = '<e>' lstm_unit = 64 attention_unit = 1 epochs = 400
lines = open("../in/input02.txt").read().splitlines() count = 0 for line in lines: line = line.replace('-',' ').replace(':','').split(' ') # print(line) # print(line[3].count(line[2])) if int(line[0]) <= line[3].count(line[2]) <= int(line[1]): count = count + 1 print('part 1: ',count...
lines = open('../in/input02.txt').read().splitlines() count = 0 for line in lines: line = line.replace('-', ' ').replace(':', '').split(' ') if int(line[0]) <= line[3].count(line[2]) <= int(line[1]): count = count + 1 print('part 1: ', count) lines = open('../in/input02.txt').read().splitlines() count =...
''' This file will control the keyboard mapping to flying commands. The init routine will setup the default values, however, the api supports the ability to update the value for any of the flying commands. ''' LAND1 = "LAND1" FORWARD = "FORWARD" BACKWARD = "BACKWARD" LEFT = "LEFT" RIGHT = "RIGHT" CLOCKWISE = "CLOCKWI...
""" This file will control the keyboard mapping to flying commands. The init routine will setup the default values, however, the api supports the ability to update the value for any of the flying commands. """ land1 = 'LAND1' forward = 'FORWARD' backward = 'BACKWARD' left = 'LEFT' right = 'RIGHT' clockwise = 'CLOCKWIS...
class Moon: position = [None, None, None] velocity = [None, None, None] def __init__(self, position): self.position = list(position) self.velocity = [0] * len(position) def ApplyGravity(self, moons): for moon in moons: for coord in range(len(moon.position)): ...
class Moon: position = [None, None, None] velocity = [None, None, None] def __init__(self, position): self.position = list(position) self.velocity = [0] * len(position) def apply_gravity(self, moons): for moon in moons: for coord in range(len(moon.position)): ...
def compute(original_input): # copy of input input = [x for x in original_input] pointer = 0 while(input[pointer] != 99): if input[pointer] == 1: input[input[pointer+3]] = input[input[pointer+1]] + input[input[pointer+2]] elif input[pointer] == 2: input[input[poi...
def compute(original_input): input = [x for x in original_input] pointer = 0 while input[pointer] != 99: if input[pointer] == 1: input[input[pointer + 3]] = input[input[pointer + 1]] + input[input[pointer + 2]] elif input[pointer] == 2: input[input[pointer + 3]] = inp...
def wheat_from_chaff(values): last=len(values)-1 for i, j in enumerate(values): if j<0: continue rec=last while values[last]>=0: last-=1 if i>=last: break values[last], values[i]=values[i], values[last] if rec==last: ...
def wheat_from_chaff(values): last = len(values) - 1 for (i, j) in enumerate(values): if j < 0: continue rec = last while values[last] >= 0: last -= 1 if i >= last: break (values[last], values[i]) = (values[i], values[last]) if ...
# https://programmers.co.kr/learn/courses/30/lessons/60058?language=python3 def solution(p): answer = '' def is_balanced(p): return p.count("(") == p.count(")") def is_correct(p): count = 0 if is_balanced(p): for x in p: if x =='(': count += 1 ...
def solution(p): answer = '' def is_balanced(p): return p.count('(') == p.count(')') def is_correct(p): count = 0 if is_balanced(p): for x in p: if x == '(': count += 1 else: count -= 1 ...
def rotLeft(a, d): # shift d times to the left (d is in the range of 1 - n) n = len(a) temp = [None for _ in range(n)] for i in range(n): temp[i-d] = a[i] return temp # driver code print(rotLeft([1,2,3,4,5], 4))
def rot_left(a, d): n = len(a) temp = [None for _ in range(n)] for i in range(n): temp[i - d] = a[i] return temp print(rot_left([1, 2, 3, 4, 5], 4))
A, B = [int(a) for a in input().split()] outlet = 1 ans = 0 while outlet < B: outlet += A-1 ans += 1 print(ans)
(a, b) = [int(a) for a in input().split()] outlet = 1 ans = 0 while outlet < B: outlet += A - 1 ans += 1 print(ans)
# -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incor...
def load_arguments(self, _): with self.argument_context('datamigration get-assessment') as c: c.argument('connection_string', nargs='+', help='Sql Server Connection Strings') c.argument('output_folder', type=str, help='Output folder to store assessment report') c.argument('config_file_path',...
boot_capacity = float(input()) entries = 0 capacity = 0 suitcases_inside = 0 command = input() while command != "End": suitcases = float(command) entries += 1 suitcases_inside += 1 command = input() if entries % 3 == 0: capacity += suitcases + suitcases * 10 / 100 if capacity > b...
boot_capacity = float(input()) entries = 0 capacity = 0 suitcases_inside = 0 command = input() while command != 'End': suitcases = float(command) entries += 1 suitcases_inside += 1 command = input() if entries % 3 == 0: capacity += suitcases + suitcases * 10 / 100 if capacity > boot_...
class LargerStrKey(str): def __lt__(x: str, y: str) -> bool: return x + y > y + x class Solution: def largestNumber(self, nums: List[int]) -> str: return ''.join(sorted(map(str, nums), key=LargerStrKey)).lstrip('0') or '0'
class Largerstrkey(str): def __lt__(x: str, y: str) -> bool: return x + y > y + x class Solution: def largest_number(self, nums: List[int]) -> str: return ''.join(sorted(map(str, nums), key=LargerStrKey)).lstrip('0') or '0'
"\n" "\nfoo" "bar\n" "foo\nbar"
""" """ '\nfoo' 'bar\n' 'foo\nbar'
{ "targets": [ { "target_name": "module", "sources": [ "cc/module.cc", "cc/functions.cc", "cc/satgraph.cc" ] } ] }
{'targets': [{'target_name': 'module', 'sources': ['cc/module.cc', 'cc/functions.cc', 'cc/satgraph.cc']}]}
# # PySNMP MIB module NSCHippiSonet-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NSCHippiSonet-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:15:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_union, value_range_constraint, constraints_intersection, value_size_constraint) ...
def test_python_is_installed(host): assert host.run('python --version').rc == 0 def test_sudo_is_installed(host): assert host.run('sudo --version').rc == 0
def test_python_is_installed(host): assert host.run('python --version').rc == 0 def test_sudo_is_installed(host): assert host.run('sudo --version').rc == 0
### we prepend t_ to tablenames and f_ to fieldnames for disambiguity ######################################## db.define_table('t_queue', Field('f_name', type='string', label=T('Name')), auth.signature, format='%(f_name)s', migrate=settings.migrate) db.define_table('t_queue_archive',db.t_qu...
db.define_table('t_queue', field('f_name', type='string', label=t('Name')), auth.signature, format='%(f_name)s', migrate=settings.migrate) db.define_table('t_queue_archive', db.t_queue, field('current_record', 'reference t_queue', readable=False, writable=False))
# -*- coding: utf-8 -*- # @author: Longxing Tan, tanlongxing888@163.com # @date: 2020-09 class GBDTRegressor(object): # This model can predict multiple steps time series prediction by GBDT model, and the main 3 mode can be all included def __init__(self, use_model, each_model_per_prediction, extend_prediction...
class Gbdtregressor(object): def __init__(self, use_model, each_model_per_prediction, extend_prediction_to_train, extend_weights=None): pass def train(self, x_train, y_train, x_valid=None, y_valid=None, categorical_features=None, fit_params={}): pass def predict(self): pass d...
# 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 maximumAverageSubtree(self, root: TreeNode) -> float: maxScore = 0 def dfs(curr): ...
class Solution: def maximum_average_subtree(self, root: TreeNode) -> float: max_score = 0 def dfs(curr): nonlocal maxScore if not curr: return (0, 0) (left_sum, left_count) = dfs(curr.left) (right_sum, right_count) = dfs(curr.right) ...
#shift cracker global iora; iora = "" alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] def crack(text): for integer in range(0,len(text)): v = text[integer] vv = text[integer+1] ...
global iora iora = '' alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] def crack(text): for integer in range(0, len(text)): v = text[integer] vv = text[integer + 1] vvv = text[integer + 2] if v...
class Singleton(type): instance = None def __call__(cls, *args, **kw): if not cls.instance: cls.instance = super(Singleton, cls).__call__(*args, **kw) return cls.instance class SingletonObject(object): __metaclass__ = Singleton a = SingletonObject() b = SingletonObject() pr...
class Singleton(type): instance = None def __call__(cls, *args, **kw): if not cls.instance: cls.instance = super(Singleton, cls).__call__(*args, **kw) return cls.instance class Singletonobject(object): __metaclass__ = Singleton a = singleton_object() b = singleton_object() prin...
# Django settings for example project. ########################################################################### INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'example', ###############...
installed_apps = ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', 'example', 'ajax_select') ajax_lookup_channels = {'label': {'model': 'example.label', 'search_field': 'name'}, 'person': ('example.lookups', 'PersonLookup'), 'group': ('exam...
def load_wmap(filename): wmap = dict() with open(filename, 'rb') as fp: for line in fp: entry = line.strip().split('\t') if len(entry) != 2: continue try: wmap[entry[1].decode('utf-8')] = int(entry[0]) except ValueError...
def load_wmap(filename): wmap = dict() with open(filename, 'rb') as fp: for line in fp: entry = line.strip().split('\t') if len(entry) != 2: continue try: wmap[entry[1].decode('utf-8')] = int(entry[0]) except ValueError: ...
class Event: def __init__(self, _src, _target, _type, _time): self.src = _src self.target = _target self.type = _type self.time = _time def __eq__(self, other): return self.__dict__ == other.__dict__
class Event: def __init__(self, _src, _target, _type, _time): self.src = _src self.target = _target self.type = _type self.time = _time def __eq__(self, other): return self.__dict__ == other.__dict__
__author__ = 'Viswanath Chidambaram' __email__ = 'viswanc@thoughtworks.com' __version__ = '0.0.1'
__author__ = 'Viswanath Chidambaram' __email__ = 'viswanc@thoughtworks.com' __version__ = '0.0.1'
def test_str(project_client): project = project_client assert project.__str__() == project._domain.__str__() def test_get_repository(rubicon_client): rubicon = rubicon_client assert rubicon.repository == rubicon.config.repository
def test_str(project_client): project = project_client assert project.__str__() == project._domain.__str__() def test_get_repository(rubicon_client): rubicon = rubicon_client assert rubicon.repository == rubicon.config.repository
# EXAMPLE PATH: define the actual path on your system gpkg_path = "C:/Users/joker/OneDrive/Mantsa 6. vuosi/Work/PYQGIS-dev/data/practical_data.gpkg" # windows gpkg_layer = QgsVectorLayer(gpkg_path, "whole_gpkg", "ogr") # returns a list of strings describing the sublayers # !!::!! separetes the values # EXAMPLE: 1!!::!!...
gpkg_path = 'C:/Users/joker/OneDrive/Mantsa 6. vuosi/Work/PYQGIS-dev/data/practical_data.gpkg' gpkg_layer = qgs_vector_layer(gpkg_path, 'whole_gpkg', 'ogr') sub_strings = gpkg_layer.dataProvider().subLayers() for sub_string in sub_strings: layer_name = sub_string.split(gpkg_layer.dataProvider().sublayerSeparator())...
class HttpError(Exception): def __init__(self, res, data): self.res = res self.status = res.status_code self.reason = res.reason_phrase self.method = res.method if isinstance(data, dict): self.message = data.get('statusMessage', '') else: self....
class Httperror(Exception): def __init__(self, res, data): self.res = res self.status = res.status_code self.reason = res.reason_phrase self.method = res.method if isinstance(data, dict): self.message = data.get('statusMessage', '') else: self...
# -*- python -*- # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of con...
{'variables': {'conditions': [['OS=="linux"', {'syscall_handler': ['linux/nacl_syscall_impl.c']}], ['OS=="mac"', {'syscall_handler': ['linux/nacl_syscall_impl.c']}], ['OS=="win"', {'syscall_handler': ['win/nacl_syscall_impl.c'], 'msvs_cygwin_shell': 0}]]}, 'includes': ['../../../build/common.gypi'], 'target_defaults': ...
''' 1. Write a Python program to find the single element appears once in a list where every element appears four times except for one. Input : [1, 1, 1, 2, 2, 2, 3] Output : 3 2. Write a Python program to find two elements appear twice in a list where all the other elements appear exactly twice in the list. Input : ...
""" 1. Write a Python program to find the single element appears once in a list where every element appears four times except for one. Input : [1, 1, 1, 2, 2, 2, 3] Output : 3 2. Write a Python program to find two elements appear twice in a list where all the other elements appear exactly twice in the list. Input : ...
class RuleChecker: def __init__(self): pass ''' data: a list of data that has the format {'price': 0.5}, sorted by time descending ''' def check(self, rule, data): return getattr(self, rule)(data) def oldest_newest_single_larger_than_5per(self, tickerData): data = ticke...
class Rulechecker: def __init__(self): pass "\n data: a list of data that has the format {'price': 0.5}, sorted by time descending\n " def check(self, rule, data): return getattr(self, rule)(data) def oldest_newest_single_larger_than_5per(self, tickerData): data = ticker...
'Constant strings for scripts in the repo' UPLOAD_CONTAINER = 'results' UPLOAD_TOKEN_VAR = 'PERFLAB_UPLOAD_TOKEN' UPLOAD_STORAGE_URI = 'https://pvscmdupload.{}.core.windows.net' UPLOAD_QUEUE = 'resultsqueue'
"""Constant strings for scripts in the repo""" upload_container = 'results' upload_token_var = 'PERFLAB_UPLOAD_TOKEN' upload_storage_uri = 'https://pvscmdupload.{}.core.windows.net' upload_queue = 'resultsqueue'
for _ in range(int(input())): n,m=map(int,input().split()) l=[] for i in range(n): l1=list(map(int,input().split())) l.append(l1) for i in range(n): for j in range(m): if i%2==1: if j%2==1: if l[i][j]%2==0: l...
for _ in range(int(input())): (n, m) = map(int, input().split()) l = [] for i in range(n): l1 = list(map(int, input().split())) l.append(l1) for i in range(n): for j in range(m): if i % 2 == 1: if j % 2 == 1: if l[i][j] % 2 == 0: ...
src = Split(''' api/api_readholdingregisters.c pdu/readholdingregisters.c adu/rtu/rtu.c adu/rtu/mbcrc.c physical/serial.c auxiliary/log.c auxiliary/other.c api/mbm.c ''') component = aos_component('mbmaster', src) component.add_global_includes('includ...
src = split('\n api/api_readholdingregisters.c\n pdu/readholdingregisters.c\n adu/rtu/rtu.c\n adu/rtu/mbcrc.c\n physical/serial.c\n auxiliary/log.c\n auxiliary/other.c\n api/mbm.c\n') component = aos_component('mbmaster', src) component.add_global_includes('includ...
# Element der Fibonacci-Folge berechnen: def fib(n): if n == 0: # f(0) = 0 return 0 elif n == 1: # f(1) = 1 return 1 else: # f(n) = f(n-1) + f(n-2) return fib (n-1) + fib (n-2) # Ackermann-Funktion berechnen: def ack(m,n): if m == 0: # A(0,n) = n+1 return n+1 elif n == 0: # A(...
def fib(n): if n == 0: return 0 elif n == 1: return 1 else: return fib(n - 1) + fib(n - 2) def ack(m, n): if m == 0: return n + 1 elif n == 0: return ack(m - 1, 1) else: return ack(m - 1, ack(m, n - 1)) def hailstone(n): print(n) if n != ...
class To_int_ask: def __init__(self): pass def func_(self): try: self.a = int(input('> ')) return self.a except ValueError: print('''Maybe you entered some str symbol's, try with out it''') ret = self.func_() retur...
class To_Int_Ask: def __init__(self): pass def func_(self): try: self.a = int(input('> ')) return self.a except ValueError: print("Maybe you entered some str symbol's, try with out it") ret = self.func_() return ret
n,k=map(int, input().split()) s = input() nums = [] sums = [] cnt = 1 for i in range(1, n): if s[i - 1] != s[i]: nums.append(int(s[i - 1])) sums.append(cnt) cnt = 1 else: cnt += 1 candi = 0 ansli = [] if s[0] == "0": if s[-1] == "0": k = min(k, len(sums)//2 + 1) ...
(n, k) = map(int, input().split()) s = input() nums = [] sums = [] cnt = 1 for i in range(1, n): if s[i - 1] != s[i]: nums.append(int(s[i - 1])) sums.append(cnt) cnt = 1 else: cnt += 1 candi = 0 ansli = [] if s[0] == '0': if s[-1] == '0': k = min(k, len(sums) // 2 + 1...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- add(1, 2) + "!" result =add(1, 2) + "!" result= add(1, 2) + "!" result = add(1, 2) + "!" x= add(1, 2) + "!" def add(x: int, y: int) -> int: add(1, 2) + "!" result =add(1, 2) + "!" result= add(1, 2) + "!" result = add(1, 2) + "!" x= add(1, 2) + "!" def xadd(x: int,...
add(1, 2) + '!' result = add(1, 2) + '!' result = add(1, 2) + '!' result = add(1, 2) + '!' x = add(1, 2) + '!' def add(x: int, y: int) -> int: add(1, 2) + '!' result = add(1, 2) + '!' result = add(1, 2) + '!' result = add(1, 2) + '!' x = add(1, 2) + '!' def xadd(x: int, y: int) -> int: ...