content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
valores = input().split() valores = list(map(int,valores)) h1, h2 = valores if(h1 == h2): print('O JOGO DUROU %d HORA(S)' %24) else: if(h2 < h1): print('O JOGO DUROU %d HORA(S)' %((24 - h1) + h2)) else: print('O JOGO DUROU %d HORA(S)' %(h2 - h1))
valores = input().split() valores = list(map(int, valores)) (h1, h2) = valores if h1 == h2: print('O JOGO DUROU %d HORA(S)' % 24) elif h2 < h1: print('O JOGO DUROU %d HORA(S)' % (24 - h1 + h2)) else: print('O JOGO DUROU %d HORA(S)' % (h2 - h1))
def WriteOBJ(filename, vertrices, vts, vns, facesV, facesVt, facesVn): f=file(filename,"w+") for vertex in vertrices: f.write("v ") for i in range(len(vertex)): f.write(str(vertex[i])) f.write(" ") f.write("\n") if len(vts) != 0: for vt in vts: ...
def write_obj(filename, vertrices, vts, vns, facesV, facesVt, facesVn): f = file(filename, 'w+') for vertex in vertrices: f.write('v ') for i in range(len(vertex)): f.write(str(vertex[i])) f.write(' ') f.write('\n') if len(vts) != 0: for vt in vts: ...
num1=10 num2=20 num3=30 num4=40 num5=50 num6=60 nihaoma=weijialan
num1 = 10 num2 = 20 num3 = 30 num4 = 40 num5 = 50 num6 = 60 nihaoma = weijialan
while True: try: chars = input() # nums = int(chars) level0 = ['zero'] level1 = ['','one','two','three','four','five','six', 'seven',' eight','nine', 'ten'] level1_1= ['','eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixten', 'seventeen', 'eighteen', 'nineteen'] ...
while True: try: chars = input() level0 = ['zero'] level1 = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', ' eight', 'nine', 'ten'] level1_1 = ['', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixten', 'seventeen', 'eighteen', 'nineteen'] level2 = ['',...
items = [2, 25, 9] divisor = 12 for item in items: if item%divisor == 0: found = item break else: # nobreak items.append(divisor) found = divisor print("{items} contains {found} which is a multiple of {divisor}" .format(**locals()))
items = [2, 25, 9] divisor = 12 for item in items: if item % divisor == 0: found = item break else: items.append(divisor) found = divisor print('{items} contains {found} which is a multiple of {divisor}'.format(**locals()))
class Solution: def hIndex(self, citations): n = len(citations) at_least = [0] * (n + 2) for c in citations: at_least[min(c, n + 1)] += 1 for i in xrange(n, -1, -1): at_least[i] += at_least[i + 1] for i in xrange(n, -1, -1): if...
class Solution: def h_index(self, citations): n = len(citations) at_least = [0] * (n + 2) for c in citations: at_least[min(c, n + 1)] += 1 for i in xrange(n, -1, -1): at_least[i] += at_least[i + 1] for i in xrange(n, -1, -1): if at_least[i...
class ColumnRef: table = '' column = '' cascade_row = None def __init__(self, table, column, cascade_row=True): # cascade_row=True means that row in table should be removed # if value in column that owns reference is not found. # i.e, reference from stop_times.stop_id to stops....
class Columnref: table = '' column = '' cascade_row = None def __init__(self, table, column, cascade_row=True): self.table = table self.column = column self.cascade_row = cascade_row
numbers = [1,2,3,4,5,6,7,11] res = 0 for num in numbers: res = res + num print("with sum: ",sum(numbers)) print("without sum: ",res)
numbers = [1, 2, 3, 4, 5, 6, 7, 11] res = 0 for num in numbers: res = res + num print('with sum: ', sum(numbers)) print('without sum: ', res)
def remove_duplicates(S: str) -> str: r = S[0] for i in range(1, len(S)): if len(r) == 0: r += S[i] else: if r[-1] == S[i]: if len(r) == 1: r = '' else: r = r[:-1] else: r ...
def remove_duplicates(S: str) -> str: r = S[0] for i in range(1, len(S)): if len(r) == 0: r += S[i] elif r[-1] == S[i]: if len(r) == 1: r = '' else: r = r[:-1] else: r += S[i] return r
f1, f2 = map(float, input().split()) flutuacao = 1.0 * (1.0 + f1/100) * (1 + f2/100) print("%.6f" % ((flutuacao - 1.0)*100))
(f1, f2) = map(float, input().split()) flutuacao = 1.0 * (1.0 + f1 / 100) * (1 + f2 / 100) print('%.6f' % ((flutuacao - 1.0) * 100))
class Primes: def __init__(self, first, last=None): self.curr = None if last is None: self.first = 2 self.last = first else: self.first = first self.last = last def __iter__(self): return self def __next__(self): if s...
class Primes: def __init__(self, first, last=None): self.curr = None if last is None: self.first = 2 self.last = first else: self.first = first self.last = last def __iter__(self): return self def __next__(self): if s...
a, b = map(int, input().split()) while a != 0 and b != 0: if a > 0 and b > 0: print("primeiro") elif a < 0 < b: print("segundo") elif a < 0 and b < 0: print("terceiro") elif a > 0 > b: print("quarto") a, b = map(int, input().split())
(a, b) = map(int, input().split()) while a != 0 and b != 0: if a > 0 and b > 0: print('primeiro') elif a < 0 < b: print('segundo') elif a < 0 and b < 0: print('terceiro') elif a > 0 > b: print('quarto') (a, b) = map(int, input().split())
# https://github.com/michal037 class Singleton: def __new__(cls, *_, **__): self = object.__new__(cls) cls.__new__ = lambda *a, **b: self return self def singleton(self): self.__class__.__new__ = lambda *c, **d: self ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ### EXAMPLE 1 ########## class My...
class Singleton: def __new__(cls, *_, **__): self = object.__new__(cls) cls.__new__ = lambda *a, **b: self return self def singleton(self): self.__class__.__new__ = lambda *c, **d: self class Myclass(Singleton): def __init__(self, a, *args, **kwargs): self.val = a...
def climbStairs(n: int) -> int: stairs = [1, 1] for i in range(2, n + 1): stairs.append(stairs[-1] + stairs[-2]) return stairs[n]
def climb_stairs(n: int) -> int: stairs = [1, 1] for i in range(2, n + 1): stairs.append(stairs[-1] + stairs[-2]) return stairs[n]
text=input('Enter and check if your input is a palindrome or not: ') ltext=text.lower() rtext="".join((reversed(ltext))) if rtext==ltext: print('Your input is a palindrome.') else: print('Your input is not a palindrome.')
text = input('Enter and check if your input is a palindrome or not: ') ltext = text.lower() rtext = ''.join(reversed(ltext)) if rtext == ltext: print('Your input is a palindrome.') else: print('Your input is not a palindrome.')
def kmp(s): p = [-1] k = -1 for c in s: while k >= 0 and s[k] != c: k = p[k] k += 1 p.append(k) return p def period(s): k = len(s) - kmp(s)[-1] if len(s) % k == 0: return k return len(s) s = input() m = int(input()) p = period(s) print(m // p % (10**9 + 7))
def kmp(s): p = [-1] k = -1 for c in s: while k >= 0 and s[k] != c: k = p[k] k += 1 p.append(k) return p def period(s): k = len(s) - kmp(s)[-1] if len(s) % k == 0: return k return len(s) s = input() m = int(input()) p = period(s) print(m // p % (1...
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def split(self, head): slow = head fast = head slow_pre = head while fast and fast.next: slow_pre = slow ...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def split(self, head): slow = head fast = head slow_pre = head while fast and fast.next: slow_pre = slow (slow, fast) = (slow.next, fas...
def solve(arr, duration): if len(arr) == 0: return 0 result = 0 start = arr[0] for i in range(1, len(arr)): if arr[i] - arr[i - 1] > duration: result += arr[i - 1] + duration - start start = arr[i] result += arr[-1] + duration - start return result A ...
def solve(arr, duration): if len(arr) == 0: return 0 result = 0 start = arr[0] for i in range(1, len(arr)): if arr[i] - arr[i - 1] > duration: result += arr[i - 1] + duration - start start = arr[i] result += arr[-1] + duration - start return result a = [1,...
class Solution: def setZeroes(self, matrix): rows, cols = set(), set() for i, r in enumerate(matrix): for j, c in enumerate(r): if c == 0: rows.add(i) cols.add(j) l = len(matrix[0]) for r in rows: matrix...
class Solution: def set_zeroes(self, matrix): (rows, cols) = (set(), set()) for (i, r) in enumerate(matrix): for (j, c) in enumerate(r): if c == 0: rows.add(i) cols.add(j) l = len(matrix[0]) for r in rows: ...
counter = 0 b = 106700 c = 123700 step = 17 for target in range(b, c + step, step): flag = False d = 2 while d != target: e = target // d if e < d: break if target % d == 0: flag = True #print("d: {0:d} e: {1:d} b: {2:d}".format(d, e, target)) break ...
counter = 0 b = 106700 c = 123700 step = 17 for target in range(b, c + step, step): flag = False d = 2 while d != target: e = target // d if e < d: break if target % d == 0: flag = True break d += 1 if flag: counter += 1 els...
class Person: def __init__(self, name, age): self.name = name self.age = age def sayHello(self): print("Hello my name is {} and I am {} years old".format(self.name, self.age)) worker = Person("Alina", 21) print(worker.age) print(worker.name) worker.sayHello()
class Person: def __init__(self, name, age): self.name = name self.age = age def say_hello(self): print('Hello my name is {} and I am {} years old'.format(self.name, self.age)) worker = person('Alina', 21) print(worker.age) print(worker.name) worker.sayHello()
def partition(a,l,r): #assert: Previous proof but partitions between l and r # It considers the first element as a pivot and moves all smaller element to left of it and greater elements to right x=a[l] n=len(a) i=l j=r while(i<j): if a[i]>=x and a[j]<=x: a[i],a[j...
def partition(a, l, r): x = a[l] n = len(a) i = l j = r while i < j: if a[i] >= x and a[j] <= x: (a[i], a[j]) = (a[j], a[i]) i += 1 j -= 1 elif a[i] < x: i += 1 else: j -= 1 return (a, i) def kth(a, l, r, k): ...
''' Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example: Input: head = 1->4->3->2->5->2, x = 3 Output: 1->2->2->4->3->5 Runtime: 20 ms, faster...
""" Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. Example: Input: head = 1->4->3->2->5->2, x = 3 Output: 1->2->2->4->3->5 Runtime: 20 ms, faster...
def factorial(n): fact=1 for i in range(1,n+1): fact*=i print(fact) factorial(5)
def factorial(n): fact = 1 for i in range(1, n + 1): fact *= i print(fact) factorial(5)
print('''@#############################################################MMMMMMMMMMMMMMMMMMBBBBMMMMBB&AMBAHM###MMMMMMM# @hG&&AA&&A&G&&&&GG&AA&&&&&AAAAAA&&&G&&&GGhh&AAAG93XX39h93X225iiiS5SSSSSSSiSiSSisssssiisssi:.;s;iXX25Sii25SSA @hAAHAAHAHAAAAAAAAAAAAAAAAAAAAAAAHHHAAAG&&3Ssi5G&GG&&GG9333X2552222222255525rrSSS55SSSiSS5X;:...
print('@#############################################################MMMMMMMMMMMMMMMMMMBBBBMMMMBB&AMBAHM###MMMMMMM#\n@hG&&AA&&A&G&&&&GG&AA&&&&&AAAAAA&&&G&&&GGhh&AAAG93XX39h93X225iiiS5SSSSSSSiSiSSisssssiisssi:.;s;iXX25Sii25SSA\n@hAAHAAHAHAAAAAAAAAAAAAAAAAAAAAAAHHHAAAG&&3Ssi5G&GG&&GG9333X2552222222255525rrSSS55SSSiSS5X;:...
# SETTINGS FILE # TOKEN - discord app token # BOT PREFIX - no explanation needed (uhh I think) # API_AUTH - hypixel api auth # DB_CLIENT - your DB URI # DB_NAME - no explanation needed # APPLICATION_ID - discord app id TOKEN='' BOT_PREFIX='$' API_AUTH='' DB_CLIENT = '' DB_NAME = '' APPLICATION_ID=''
token = '' bot_prefix = '$' api_auth = '' db_client = '' db_name = '' application_id = ''
# -*- coding: utf-8 -*- class Symbol(object): def __init__(self, symbol): self.number = int(symbol['number']) self.numberEx = int(symbol['numberEx']) self.name = symbol['name'] self.var = symbol['var'] def __str__(self): return '\t\t\t\tNumber: {0} \n\t\t\t\tNu...
class Symbol(object): def __init__(self, symbol): self.number = int(symbol['number']) self.numberEx = int(symbol['numberEx']) self.name = symbol['name'] self.var = symbol['var'] def __str__(self): return '\t\t\t\tNumber: {0} \n\t\t\t\tNumberEx: {1} \n\t\t\t\tName: {2} \...
def mutate(soup): paragraphs = get_max_paragraph_set(soup) headline = soup.find('h1') html = str(headline) + '\n' for paragraph in paragraphs: html += str(paragraph) + '\n' return html def get_max_paragraph_set(soup): paragraph_map = build_paragraph_map(soup) key = get_max_key(paragraph_map) if key is None:...
def mutate(soup): paragraphs = get_max_paragraph_set(soup) headline = soup.find('h1') html = str(headline) + '\n' for paragraph in paragraphs: html += str(paragraph) + '\n' return html def get_max_paragraph_set(soup): paragraph_map = build_paragraph_map(soup) key = get_max_key(parag...
a = 3 while a >= 3: print("CSK Wins") break user_input = input('Enter City') while user_input == 'Chennai': print('Chennai pasanga da') break user_in = input('Enter Country') while type(user_in) == str: if user_in == 'India': print('India is the best') break else: pri...
a = 3 while a >= 3: print('CSK Wins') break user_input = input('Enter City') while user_input == 'Chennai': print('Chennai pasanga da') break user_in = input('Enter Country') while type(user_in) == str: if user_in == 'India': print('India is the best') break else: print('...
letters = 'aeiou' txt = input("Podaj tekst: ") txt = txt.casefold() count = {}.fromkeys(letters,0) for ch in txt: if ch in count: count[ch] +=1 print(count)
letters = 'aeiou' txt = input('Podaj tekst: ') txt = txt.casefold() count = {}.fromkeys(letters, 0) for ch in txt: if ch in count: count[ch] += 1 print(count)
#!/usr/bin/python3 class Line: def __init__(self, x1, y1, x2, y2): self.x1 = int(x1) self.y1 = int(y1) self.x2 = int(x2) self.y2 = int(y2) self.rangex = abs(self.x2 - self.x1) self.rangey = abs(self.y2 - self.y1) def print(self): print(str(self.x1) + "," ...
class Line: def __init__(self, x1, y1, x2, y2): self.x1 = int(x1) self.y1 = int(y1) self.x2 = int(x2) self.y2 = int(y2) self.rangex = abs(self.x2 - self.x1) self.rangey = abs(self.y2 - self.y1) def print(self): print(str(self.x1) + ',' + str(self.y1) + '...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: # handle exceptions if head==None or head.next==None: re...
class Solution: def delete_duplicates(self, head: ListNode) -> ListNode: if head == None or head.next == None: return head prehead = list_node(val=-1000, next=head) pre = prehead curr = head post = head.next counter = 1 while post: whi...
# -*- coding: utf-8 -*- # Author: Daniel Yang <daniel.yj.yang@gmail.com> # # License: BSD 3 clause def demo(): # reference: https://scikit-learn.org/stable/modules/classes.html#module-sklearn.cluster # https://scikit-learn.org/stable/modules/clustering.html pass
def demo(): pass
# Event: LCCS Python Fundamental Skills Workshop # Date: May 2018 # Author: Joe English, PDST # eMail: computerscience@pdst.ie # Purpose: A program to demonstrate how to create lists # Lists can be created with data (each value is a list element) boysNames = ['John', 'Jim', 'Alex', 'Fred'] girlsNames = ['Sarah...
boys_names = ['John', 'Jim', 'Alex', 'Fred'] girls_names = ['Sarah', 'Alex', 'Pat', 'Mary'] favourite_songs = ['Moondance', 'Linger', 'Stairway to Heaven'] fruits = ['Strawberry', 'Lemon', 'Orange', 'Raspberry', 'Cherry'] vehicle_count = [0, 0, 0, 0, 0, 0] account_details = [1234, 'xyz', 'Alex', '1 Main Street', 827.56...
NL = b'\n' DATA_SIZE = 4 FRAME_SIZE = 4 HEADER_SIZE = DATA_SIZE + FRAME_SIZE TIMESTAMP_SIZE = 8 ATTEMPTS_SIZE = 2 MSG_ID_SIZE = 16 MSG_HEADER = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE
nl = b'\n' data_size = 4 frame_size = 4 header_size = DATA_SIZE + FRAME_SIZE timestamp_size = 8 attempts_size = 2 msg_id_size = 16 msg_header = TIMESTAMP_SIZE + ATTEMPTS_SIZE + MSG_ID_SIZE
def run(df, docs): for doc in docs: doc.start("t11 - Transform Unique Id", df) # Creates a unique id df['nProcesso_agrupamento'] = str(df['nProcesso']) + '_' + str(df['agrupamento']) for doc in docs: doc.end(df) return df
def run(df, docs): for doc in docs: doc.start('t11 - Transform Unique Id', df) df['nProcesso_agrupamento'] = str(df['nProcesso']) + '_' + str(df['agrupamento']) for doc in docs: doc.end(df) return df
numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54] def highest_num(numbers_in): highest = numbers_in[0] for count in range(len(numbers_in)): if highest < numbers_in[count]: highest = numbers_in[count] return highest highest_out = highest_num(numbers) print("The highest number...
numbers = [9, 8, 72, 22, 21, 81, 2, 1, 11, 76, 32, 54] def highest_num(numbers_in): highest = numbers_in[0] for count in range(len(numbers_in)): if highest < numbers_in[count]: highest = numbers_in[count] return highest highest_out = highest_num(numbers) print('The highest number is', h...
with (a, c,): pass with (a as b, c): pass async with (a, c,): pass async with (a as b, c): pass
with a, c: pass with a as b, c: pass async with a, c: pass async with a as b, c: pass
class FilasColumnas: def __init__(self, nombre, filas, columnas): self.nombre = nombre self.filas = filas self.columnas = columnas def getNombre(self): return self.nombre def getFilas(self): return self.filas def getColumnas(self): return s...
class Filascolumnas: def __init__(self, nombre, filas, columnas): self.nombre = nombre self.filas = filas self.columnas = columnas def get_nombre(self): return self.nombre def get_filas(self): return self.filas def get_columnas(self): return self.filas
#!/usr/bin/env python # coding: utf-8 # Write a function to which would return the greatest common of factor. # # <b> Input : 18, 27</b> # # <b> return: 9 </b> # # # In[1]: # Get the smallest of the both inputs # Loop through the find the GCD# def gcd(x,y): small=min(x,y) for i in range(1,small+1): ...
def gcd(x, y): small = min(x, y) for i in range(1, small + 1): if x % i == 0 and y % i == 0: gcd = i return gcd print(gcd(18, 27)) def gcd(x, y): small = min(x, y) print('x', x) print('y', y) print('small', small) for i in range(1, small + 1): if x % i == 0 a...
peple = ["gilbert", "david", "richard"] print("welcome to my parlor, " + peple[0]) print("welcome to my parlor, " + peple[1]) print("welcome to my parlor, " + peple[2]) print("richard is too stupid to come, so his not comming.") peple = ["gilbert", "david"] print("welcome to my parlor, " + peple[0]) print("wel...
peple = ['gilbert', 'david', 'richard'] print('welcome to my parlor, ' + peple[0]) print('welcome to my parlor, ' + peple[1]) print('welcome to my parlor, ' + peple[2]) print('richard is too stupid to come, so his not comming.') peple = ['gilbert', 'david'] print('welcome to my parlor, ' + peple[0]) print('welcome to m...
BINDING_ADDRESS = ':1080' # <ADDRESS>:<PORT> BINDING_PORT = 1080 LOCAL_CERT_FILE = './local.pem' REMOTE_CERT_FILE = './remote.pem' BACKLOG = 128 LOG_LEVEL = 'info' BLOCK_SIZE = 2048 # in bytes STAFF_BINDING_ADDRESS = '127.0.0.1' STAFF_TCP_PORT = 32000 STAFF_UDP_PORT = 32000 STAFF_PROXY = '127.0.0.1:1080' ...
binding_address = ':1080' binding_port = 1080 local_cert_file = './local.pem' remote_cert_file = './remote.pem' backlog = 128 log_level = 'info' block_size = 2048 staff_binding_address = '127.0.0.1' staff_tcp_port = 32000 staff_udp_port = 32000 staff_proxy = '127.0.0.1:1080' staff_dns = '8.8.8.8:53,8.8.4.4:53' staff_dn...
def return_after_n_recursion_one(n): return_after_n_recursion_one(n-1) def return_after_n_recursion_two(n): if n < 3: # Base return: identify a condition after which you will start returning return 'Cap' return_after_n_recursion_two(n-1) def return_after_n_recursion(n): if n < 3: # Base retu...
def return_after_n_recursion_one(n): return_after_n_recursion_one(n - 1) def return_after_n_recursion_two(n): if n < 3: return 'Cap' return_after_n_recursion_two(n - 1) def return_after_n_recursion(n): if n < 3: return 'Cap' return return_after_n_recursion(n - 1) if __name__ == '__...
def KadaneAlgo(alist, start, end): #Returns (l, r, m) such that alist[l:r] is the maximum subarray in #A[start:end] with sum m. Here A[start:end] means all A[x] for start <= x < #end. max_ending_at_i = max_seen_so_far = alist[start] max_left_at_i = max_left_so_far = start # max_right_at_i is alw...
def kadane_algo(alist, start, end): max_ending_at_i = max_seen_so_far = alist[start] max_left_at_i = max_left_so_far = start max_right_so_far = start + 1 for i in range(start + 1, end): if max_ending_at_i > 0: max_ending_at_i += alist[i] else: max_ending_at_i = al...
# to allow api client save environment state to database. SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' # we use cached_db backend for longlive and fast sessions. SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db' SESSION_COOKIE_NAME = 'sid' SESSION_COOKIE_AGE = 86400 * 60 # 2...
session_serializer = 'django.contrib.sessions.serializers.PickleSerializer' session_engine = 'django.contrib.sessions.backends.cached_db' session_cookie_name = 'sid' session_cookie_age = 86400 * 60 if PRODUCTION: session_cookie_domain = '.{{project_name}}.com'
class GraphNode(object): def __init__(self, val): self.value = val self.children = [] def add_child(self, new_node): self.children.append(new_node) def remove_child(self, del_node): if del_node in self.children: self.children.remove(del_node) class...
class Graphnode(object): def __init__(self, val): self.value = val self.children = [] def add_child(self, new_node): self.children.append(new_node) def remove_child(self, del_node): if del_node in self.children: self.children.remove(del_node) class Graph(objec...
x = 'Hello "Prayuth"' # Single-Quote y = "Good Bye! 'Prayuth'" # Double-Quote z = x + y print(x) print(y) print(z)
x = 'Hello "Prayuth"' y = "Good Bye! 'Prayuth'" z = x + y print(x) print(y) print(z)
class Solution: def findMedianSortedArrays(self, nums1, nums2) -> float: x = len(nums1) y = len(nums2) if y < x: # Making sure nums1 is the smaller length array return self.findMedianSortedArrays(nums2, nums1) maxV = float('inf') minV = float('-inf') ...
class Solution: def find_median_sorted_arrays(self, nums1, nums2) -> float: x = len(nums1) y = len(nums2) if y < x: return self.findMedianSortedArrays(nums2, nums1) max_v = float('inf') min_v = float('-inf') (start, end, median) = (0, x, 0) while ...
def user_has_reporting_location(user): sql_location = user.sql_location if not sql_location: return False return not sql_location.location_type.administrative
def user_has_reporting_location(user): sql_location = user.sql_location if not sql_location: return False return not sql_location.location_type.administrative
class Solution: def canCompleteCircuit(self, gas, cost): sum = 0 total = 0 start = 0 for i in range(len(gas)): total += (gas[i] - cost[i]) if sum < 0: sum = gas[i] - cost[i] start = i else: sum += (ga...
class Solution: def can_complete_circuit(self, gas, cost): sum = 0 total = 0 start = 0 for i in range(len(gas)): total += gas[i] - cost[i] if sum < 0: sum = gas[i] - cost[i] start = i else: sum += ga...
def encrypt(text,s): result = "" # transverse the plain text for i in range(len(text)): char = text[i] # Encrypt uppercase characters in plain text if (char.isupper()): result += chr((ord(char) + s-65) % 26 + 65) # Encrypt lowercase characters in plain text ...
def encrypt(text, s): result = '' for i in range(len(text)): char = text[i] if char.isupper(): result += chr((ord(char) + s - 65) % 26 + 65) else: result += chr((ord(char) + s - 97) % 26 + 97) return result text = 'ATTACKATONCYE' s = 4 print('Plain Text : ...
def amount_of_elements_smaller(matrix, i, j): '''Count the amount of elements smaller than m[i][j] in the (square) matrix. Each column and row is sorted in ascending order. >>> amount_of_elements_smaller([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1) 4 ''' size = len(matrix) assert size == len(ma...
def amount_of_elements_smaller(matrix, i, j): """Count the amount of elements smaller than m[i][j] in the (square) matrix. Each column and row is sorted in ascending order. >>> amount_of_elements_smaller([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 1, 1) 4 """ size = len(matrix) assert size == len(ma...
# coding: utf-8 # __The Data Set__ # In[1]: r = open('la_weather.csv', 'r') # In[2]: w = r.read() # In[3]: w_list = w.split('\n') # In[4]: weather = [] for w in w_list: wt = w.split(',') weather.append(wt) weather[:5] # In[5]: del weather[0] # In[6]: col_weather = [] for w in weather: ...
r = open('la_weather.csv', 'r') w = r.read() w_list = w.split('\n') weather = [] for w in w_list: wt = w.split(',') weather.append(wt) weather[:5] del weather[0] col_weather = [] for w in weather: col_weather.append(w[1]) col_weather[:5] first_element = col_weather[0] first_element last_element = col_weathe...
URL_CONFIG ="www.python.org" DEFAULT_VALUE = 1 DEFAULT_CONSTANT = 0
url_config = 'www.python.org' default_value = 1 default_constant = 0
class Solution: def reverse(self, x: int) -> int: negative = x<0 x = abs(x) reversed = 0 while x!= 0: reversed = reversed*10 + x%10 x //= 10 if reversed > 2**31-1: return 0 return reversed if not negative else...
class Solution: def reverse(self, x: int) -> int: negative = x < 0 x = abs(x) reversed = 0 while x != 0: reversed = reversed * 10 + x % 10 x //= 10 if reversed > 2 ** 31 - 1: return 0 return reversed if not negative else -reversed
# type: ignore __all__ = [ "meshc", "barh", "trisurf", "compass", "isonormals", "plotutils", "ezcontour", "streamslice", "scatter", "rgb2ind", "usev6plotapi", "quiver", "streamline", "triplot", "tetramesh", "rose", "patch", "comet", "voronoi",...
__all__ = ['meshc', 'barh', 'trisurf', 'compass', 'isonormals', 'plotutils', 'ezcontour', 'streamslice', 'scatter', 'rgb2ind', 'usev6plotapi', 'quiver', 'streamline', 'triplot', 'tetramesh', 'rose', 'patch', 'comet', 'voronoi', 'contourslice', 'histogram', 'errorbar', 'reducepatch', 'ezgraph3', 'interpstreamspeed', 'sh...
#!/usr/bin/python print('Hello Git!') print("Nakano Masaki")
print('Hello Git!') print('Nakano Masaki')
a = [int(x) for x in input().split()] a.sort() #this command sorts the list in ascending order if a[-2]==a[-1]: print(a[-3]+a[1]) else: print(a[-2] + a[1])
a = [int(x) for x in input().split()] a.sort() if a[-2] == a[-1]: print(a[-3] + a[1]) else: print(a[-2] + a[1])
# The MessageQueue class provides an interface to be implemented by classes that store messages. class MessageQueue(object): # add a single message to the queue def add(self, folder_id, folder_path, message_type, parameters=None, sender_controller_id=None, sender_user_id=None, timestamp=None): pass ...
class Messagequeue(object): def add(self, folder_id, folder_path, message_type, parameters=None, sender_controller_id=None, sender_user_id=None, timestamp=None): pass def receive(self): pass
info = open("phonebook.txt", "r+").readlines() ph = {} for i in range(len(info)): word = info[i].split() ph[word[0]]=word[1] for i in sorted(ph.keys()): print(i,ph[i])
info = open('phonebook.txt', 'r+').readlines() ph = {} for i in range(len(info)): word = info[i].split() ph[word[0]] = word[1] for i in sorted(ph.keys()): print(i, ph[i])
print("Welcome to the roller coaster!") height = int(input("What is your height in cm? ")) canRide = False if height > 120: age = int(input("What is your age in years? ")) if age > 18: canRide = True else: canRide = False else: canRide = False if canRide: print('You can r...
print('Welcome to the roller coaster!') height = int(input('What is your height in cm? ')) can_ride = False if height > 120: age = int(input('What is your age in years? ')) if age > 18: can_ride = True else: can_ride = False else: can_ride = False if canRide: print('You can ride the ...
# # PySNMP MIB module MYLEXDAC960SCSIRAIDCONTROLLER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/MYLEXDAC960SCSIRAIDCONTROLLER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:06:54 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using P...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, constraints_intersection, single_value_constraint, value_range_constraint, value_size_constraint) ...
class GCodeSegment(): def __init__(self, code, number, x, y, z, raw): self.code = code self.number = number self.raw = raw self.x = x self.y = y self.z = z self.has_cords = (self.x is not None or self.y is not None or self.z is not None) if self.has...
class Gcodesegment: def __init__(self, code, number, x, y, z, raw): self.code = code self.number = number self.raw = raw self.x = x self.y = y self.z = z self.has_cords = self.x is not None or self.y is not None or self.z is not None if self.has_cords...
print('Welcom to the Temperature Conventer.') fahrenheit = float(input('\nWhat is the given temperature in Fahrenheit degrees? ')) celsius = (fahrenheit - 32) * 5 / 9 celsius = round(celsius, 4) kelvin = (fahrenheit + 569.67) * 5 / 9 kelvin = round(kelvin, 4) print('\nThe given temperature is equal to:') print('\nFahr...
print('Welcom to the Temperature Conventer.') fahrenheit = float(input('\nWhat is the given temperature in Fahrenheit degrees? ')) celsius = (fahrenheit - 32) * 5 / 9 celsius = round(celsius, 4) kelvin = (fahrenheit + 569.67) * 5 / 9 kelvin = round(kelvin, 4) print('\nThe given temperature is equal to:') print('\nFahre...
StageDict = { "welcome":"welcome", "hasImg":"hasImg", "registed":"registed" }
stage_dict = {'welcome': 'welcome', 'hasImg': 'hasImg', 'registed': 'registed'}
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project au...
{'includes': ['../../../webrtc/build/common.gypi'], 'targets': [{'target_name': 'rbe_components', 'type': 'static_library', 'include_dirs': ['<(webrtc_root)/modules/remote_bitrate_estimator'], 'sources': ['<(webrtc_root)/modules/remote_bitrate_estimator/test/bwe_test_logging.cc', '<(webrtc_root)/modules/remote_bitrate_...
class Solution: def removeElement(self, nums: List[int], val: int) -> int: i = 0 while i < len(nums): if nums[i] == val: nums.pop(i) else: i += 1 return len(nums)
class Solution: def remove_element(self, nums: List[int], val: int) -> int: i = 0 while i < len(nums): if nums[i] == val: nums.pop(i) else: i += 1 return len(nums)
class Animal: def __init__(self, nombre): self.nombre = nombre def dormir(self): print("zZzZ") def mover(self): print("caminar") class Sponge(Animal): def mover(self): pass class Cat(Animal): def hacer_ruido(self): print("Meow") class Fish(Animal): d...
class Animal: def __init__(self, nombre): self.nombre = nombre def dormir(self): print('zZzZ') def mover(self): print('caminar') class Sponge(Animal): def mover(self): pass class Cat(Animal): def hacer_ruido(self): print('Meow') class Fish(Animal): ...
{ 'targets': [ { 'target_name': 'ftdi_labtic', 'sources': [ 'src/ftdi_device.cc', 'src/ftdi_driver.cc' ], 'include_dirs+': [ 'src/', ], 'conditions': [ ['OS == "win"', { 'include_dirs+': [ ...
{'targets': [{'target_name': 'ftdi_labtic', 'sources': ['src/ftdi_device.cc', 'src/ftdi_driver.cc'], 'include_dirs+': ['src/'], 'conditions': [['OS == "win"', {'include_dirs+': ['lib/'], 'link_settings': {'conditions': [["target_arch=='ia32'", {'libraries': ['-l<(module_root_dir)/lib/i386/ftd2xx.lib', '-l<(module_root_...
def print_head(msg: str): start = "| " end = " |" line = "-" * (len(msg) + len(start) + len(end)) print(line) print(start + msg + end) print(line)
def print_head(msg: str): start = '| ' end = ' |' line = '-' * (len(msg) + len(start) + len(end)) print(line) print(start + msg + end) print(line)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository") def rpmpack_dependencies(): go_rules_dependencies() go_register_toolchains() gazelle_dependencies() go_repository( name = "com_g...
load('@io_bazel_rules_go//go:deps.bzl', 'go_register_toolchains', 'go_rules_dependencies') load('@bazel_gazelle//:deps.bzl', 'gazelle_dependencies', 'go_repository') def rpmpack_dependencies(): go_rules_dependencies() go_register_toolchains() gazelle_dependencies() go_repository(name='com_github_pkg_er...
#rekursif adalah fungsi yg memanggil dirinya sendiri ok sip def cetak(x): print(x) if x>1: cetak(x-1) elif x<1: cetak(x+1) cetak(5)
def cetak(x): print(x) if x > 1: cetak(x - 1) elif x < 1: cetak(x + 1) cetak(5)
def more_zeros(s): s = "".join(dict.fromkeys(s)) # Getting rid of the duplicates in order s2 = [bin(ord(i))[2:] for i in s] s2 = [len(i)>2*i.count('1') for i in s2] return [i for j, i in enumerate(s) if s2[j]] print(more_zeros("DIGEST"))
def more_zeros(s): s = ''.join(dict.fromkeys(s)) s2 = [bin(ord(i))[2:] for i in s] s2 = [len(i) > 2 * i.count('1') for i in s2] return [i for (j, i) in enumerate(s) if s2[j]] print(more_zeros('DIGEST'))
tc = int(input()) while tc: tc -= 1 n, k = map(int, input().split()) if k > 0: print(n%k) else: print(n)
tc = int(input()) while tc: tc -= 1 (n, k) = map(int, input().split()) if k > 0: print(n % k) else: print(n)
arr = list(map(int,input().split())) i = 1 while True: if i not in arr: print(i) break i+=1
arr = list(map(int, input().split())) i = 1 while True: if i not in arr: print(i) break i += 1
class Token: def __init__(self, t_type, lexeme, literal, line): self.type = t_type self.lexeme = lexeme self.literal = literal self.line = line def __repr__(self): return f"Token(type: {self.type}, lexeme: {self.lexeme}, literal: {self.literal}, line: {self.line})" c...
class Token: def __init__(self, t_type, lexeme, literal, line): self.type = t_type self.lexeme = lexeme self.literal = literal self.line = line def __repr__(self): return f'Token(type: {self.type}, lexeme: {self.lexeme}, literal: {self.literal}, line: {self.line})' cla...
CONNECTION = { 'server': 'example@mail.com', 'user': 'user', 'password': 'password', 'port': 993 } CONTENT_TYPES = ['text/plain', 'text/html'] ATTACHMENT_DIR = '' ALLOWED_EXTENSIONS = ['csv']
connection = {'server': 'example@mail.com', 'user': 'user', 'password': 'password', 'port': 993} content_types = ['text/plain', 'text/html'] attachment_dir = '' allowed_extensions = ['csv']
class LNode: def __init__(self, elem, next_=None): self.elem = elem self.next = next_ class LCList: def __init__(self): self._rear = None def is_empty(self): return self._rear is None def prepend(self, elem): p = LNode(elem) if self._rear is None: p.next = p self._rear = p else: p.next = s...
class Lnode: def __init__(self, elem, next_=None): self.elem = elem self.next = next_ class Lclist: def __init__(self): self._rear = None def is_empty(self): return self._rear is None def prepend(self, elem): p = l_node(elem) if self._rear is None: ...
counter = 0 while counter <= 5: print("counter", counter) counter = counter + 1 else: print("counter has become false ")
counter = 0 while counter <= 5: print('counter', counter) counter = counter + 1 else: print('counter has become false ')
n = int(input()) space = n-1 for i in range(n): for k in range(space): print(" ",end="") for j in range(i+1): print("* ",end="") print() space -= 1
n = int(input()) space = n - 1 for i in range(n): for k in range(space): print(' ', end='') for j in range(i + 1): print('* ', end='') print() space -= 1
type = 'MMDetector' config = '/home/linkinpark213/Source/mmdetection/configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' checkpoint = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco/faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth' conf_...
type = 'MMDetector' config = '/home/linkinpark213/Source/mmdetection/configs/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco.py' checkpoint = 'https://open-mmlab.s3.ap-northeast-2.amazonaws.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_x101_64x4d_fpn_1x_coco/faster_rcnn_x101_64x4d_fpn_1x_coco_20200204-833ee192.pth' conf_...
j = 1 while j <= 9: i = 1 while i <= j: print(f'{i}*{j}={i*j}' , end='\t') i += 1 j += 1 print()
j = 1 while j <= 9: i = 1 while i <= j: print(f'{i}*{j}={i * j}', end='\t') i += 1 j += 1 print()
# This Document class simulates the HTML DOM document object. class Document: def __init__(self, window): self.window = window self.created_elements_index = 0 # This property is required to ensure that every created HTML element can be accessed using a unique reference. def getE...
class Document: def __init__(self, window): self.window = window self.created_elements_index = 0 def get_element_by_id(self, id): return html__element(self.window, "document.getElementById('" + id + "')") def create_element(self, tagName): self.created_elements_index += 1 ...
# Resample and tidy china: china_annual china_annual = china.resample('A').last().pct_change(10).dropna() # Resample and tidy us: us_annual us_annual = us.resample('A').last().pct_change(10).dropna() # Concatenate china_annual and us_annual: gdp gdp = pd.concat([china_annual,us_annual],join='inner',axis=1) ...
china_annual = china.resample('A').last().pct_change(10).dropna() us_annual = us.resample('A').last().pct_change(10).dropna() gdp = pd.concat([china_annual, us_annual], join='inner', axis=1) print(gdp.resample('10A').last())
train = dict( batch_size=10, num_workers=4, use_amp=True, num_epochs=100, num_iters=30000, epoch_based=True, lr=0.0001, optimizer=dict( mode="adamw", set_to_none=True, group_mode="r3", # ['trick', 'r3', 'all', 'finetune'], cfg=dict(), ), grad_acc_...
train = dict(batch_size=10, num_workers=4, use_amp=True, num_epochs=100, num_iters=30000, epoch_based=True, lr=0.0001, optimizer=dict(mode='adamw', set_to_none=True, group_mode='r3', cfg=dict()), grad_acc_step=1, sche_usebatch=True, scheduler=dict(warmup=dict(num_iters=0), mode='poly', cfg=dict(lr_decay=0.9, min_coef=0...
examples = [ { "file": "FILENAME", "info": [ { "turn_num": 1, "user": "USER QUERY", "system": "HUMAN RESPONSE", "HDSA": "HDSA RESPONSE", "MarCo": "MarCo RESPONSE", "MarCo vs. system": ...
examples = [{'file': 'FILENAME', 'info': [{'turn_num': 1, 'user': 'USER QUERY', 'system': 'HUMAN RESPONSE', 'HDSA': 'HDSA RESPONSE', 'MarCo': 'MarCo RESPONSE', 'MarCo vs. system': {'Readability': ['Tie', 'MarCo', 'System'], 'Completion': ['MarCo', 'MarCo', 'Tie']}}, ...]}]
# ____ _____ # | _ \ __ _ _ |_ _| __ __ _ ___ ___ _ __ # | |_) / _` | | | || || '__/ _` |/ __/ _ \ '__| # | _ < (_| | |_| || || | | (_| | (_| __/ | # |_| \_\__,_|\__, ||_||_| \__,_|\___\___|_| # |___/ # VERSION = (0...
version = (0, 0, 1) __version__ = '.'.join(map(str, VERSION))
A, B = map(int, input().split()) result = 0 for i in range(A, B + 1): if (A + B + i) % 3 == 0: result += 1 print(result)
(a, b) = map(int, input().split()) result = 0 for i in range(A, B + 1): if (A + B + i) % 3 == 0: result += 1 print(result)
# Search in Rotated Sorted Array: https://leetcode.com/problems/search-in-rotated-sorted-array/ # There is an integer array nums sorted in ascending order (with distinct values). # Prior to being passed to your function, nums is rotated at an unknown pivot index k (0 <= k < nums.length) such that the resulting array ...
class Solution: def search(self, nums, target): (start, end) = (0, len(nums) - 1) while start <= end: mid = start + (end - start) // 2 if nums[mid] == target: return mid elif nums[mid] >= nums[start]: if target >= nums[start] and t...
def init_logger(logger_type, data): logger_profile = [] log_header = 'run_time,read_time,' # what sesnors are we logging? for k, v in data.items(): if(data[k]['device'] != ''): # check to see if our device is setup for kk, vv in data[k]['sensors'].items(): if(data[k][...
def init_logger(logger_type, data): logger_profile = [] log_header = 'run_time,read_time,' for (k, v) in data.items(): if data[k]['device'] != '': for (kk, vv) in data[k]['sensors'].items(): if data[k]['sensors'][kk]['read'] == True and data[k]['sensors'][kk]['log_on'] ==...
class Solution(object): def XXX(self, root): def dfs(node, num, ret): if node is None: return num num += 1 return max(dfs(node.left, num, ret), dfs(node.right, num, ret)) num -= 1 return dfs(root, 0, 0)
class Solution(object): def xxx(self, root): def dfs(node, num, ret): if node is None: return num num += 1 return max(dfs(node.left, num, ret), dfs(node.right, num, ret)) num -= 1 return dfs(root, 0, 0)
# Copyright 2012 Kevin Gillette. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. _ord = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_" _table = dict((c, i) for i, c in enumerate(_ord)) def encode(n, len=0): out = "" while...
_ord = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_' _table = dict(((c, i) for (i, c) in enumerate(_ord))) def encode(n, len=0): out = '' while n > 0 or len > 0: out = _ord[n & 63] + out n >>= 6 len -= 1 return out def decode(input): n = 0 for c in inpu...
class User: def __init__(self,name): self.name=name def show(self): print(self.name) user =User("ada66") user.show()
class User: def __init__(self, name): self.name = name def show(self): print(self.name) user = user('ada66') user.show()
def merge(left, right): results = [] while(len(left) and len(right)): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right] print(merge([3, 8, 12], [5, ...
def merge(left, right): results = [] while len(left) and len(right): if left[0] < right[0]: results.append(left.pop(0)) print(left) else: results.append(right.pop(0)) print(right) return [*results, *left, *right] print(merge([3, 8, 12], [5, 10,...
SIZE = 400 END_SCORE = 4000 GRID_LEN = 3 WINAT = 2048 GRID_PADDING = 10 CHROMOSOME_LEN = pow(GRID_LEN, 4) + 4*GRID_LEN*GRID_LEN + 1*(pow(GRID_LEN, 4)) TOURNAMENT_SELECTION_SIZE = 4 MUTATION_RATE = 0.4 NUMBER_OF_ELITE_CHROMOSOMES = 4 POPULATION_SIZE = 10 GEN_MAX = 10000 DONOTHINGINPUT_MAX = 5 BACKGROUND_COLOR_GAME = "...
size = 400 end_score = 4000 grid_len = 3 winat = 2048 grid_padding = 10 chromosome_len = pow(GRID_LEN, 4) + 4 * GRID_LEN * GRID_LEN + 1 * pow(GRID_LEN, 4) tournament_selection_size = 4 mutation_rate = 0.4 number_of_elite_chromosomes = 4 population_size = 10 gen_max = 10000 donothinginput_max = 5 background_color_game =...
#!/usr/bin/env python ''' ch8q2a1.py Function1 = obtain_os_version -- process the show version output and return the OS version (Version 15.0(1)M4) else return None. Looking for line such as: Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1) ''' def obtain_os_ver...
""" ch8q2a1.py Function1 = obtain_os_version -- process the show version output and return the OS version (Version 15.0(1)M4) else return None. Looking for line such as: Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1) """ def obtain_os_version(show_ver_file): ...
# 5 # / \ # 3 7 # / \ / \ # 2 4 6 8 tree = Node(5) insert(tree, Node(3)) insert(tree, Node(2)) insert(tree, Node(4)) insert(tree, Node(7)) insert(tree, Node(6)) insert(tree, Node(8)) # 5 3 2 4 7 6 8 preorder(tree)
tree = node(5) insert(tree, node(3)) insert(tree, node(2)) insert(tree, node(4)) insert(tree, node(7)) insert(tree, node(6)) insert(tree, node(8)) preorder(tree)
# Copyright (C) 2021 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
def test(name, input_dims, input_values, paddings, mode, output_dims, output_values): t = input('t', ('TENSOR_FLOAT32', input_dims)) paddings = parameter('paddings', ('TENSOR_INT32', [len(input_dims), 2]), paddings) output = output('output', ('TENSOR_FLOAT32', output_dims)) model = model().Operation('MI...
class SemanticException(Exception): def __init__(self, message, token=None): if token is None: super(SemanticException, self).__init__(message) else: super(SemanticException, self).__init__(message + ': ' + token.__str__())
class Semanticexception(Exception): def __init__(self, message, token=None): if token is None: super(SemanticException, self).__init__(message) else: super(SemanticException, self).__init__(message + ': ' + token.__str__())
keys = { "x" :"x", "y" :"y", "l" :"left", "left" :"left", "r" :"right", "right" :"right", "t" :"top", "top" :"top", "b" :"bottom", "bottom":"bottom", "w" :"width", "width" :"width", "h" :"height", "height":"height", "a" :"align", "align" :"align", "d" :"dock", "dock" :"dock" } align_values_rev...
keys = {'x': 'x', 'y': 'y', 'l': 'left', 'left': 'left', 'r': 'right', 'right': 'right', 't': 'top', 'top': 'top', 'b': 'bottom', 'bottom': 'bottom', 'w': 'width', 'width': 'width', 'h': 'height', 'height': 'height', 'a': 'align', 'align': 'align', 'd': 'dock', 'dock': 'dock'} align_values_reversed = {'TopLeft': 'tl,lt...