content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
num = 1 val = 2 val2 = 333333 val2 = 333 val3 = 55555
num = 1 val = 2 val2 = 333333 val2 = 333 val3 = 55555
oa = ord('a') def word_score(word): return sum((ord(letter) - oa + 1) for letter in word) def high(s): print(s) return max(s.split(), key=word_score)
oa = ord('a') def word_score(word): return sum((ord(letter) - oa + 1 for letter in word)) def high(s): print(s) return max(s.split(), key=word_score)
# table definition table = { 'table_name' : 'adm_tax_cats', 'module_id' : 'adm', 'short_descr' : 'Sales tax categories', 'long_descr' : 'Sales tax categories', 'sub_types' : None, 'sub_trans' : None, 'sequence' : ['seq', [], None], 'tree_params' : None, 'ro...
table = {'table_name': 'adm_tax_cats', 'module_id': 'adm', 'short_descr': 'Sales tax categories', 'long_descr': 'Sales tax categories', 'sub_types': None, 'sub_trans': None, 'sequence': ['seq', [], None], 'tree_params': None, 'roll_params': None, 'indexes': None, 'ledger_col': None, 'defn_company': None, 'data_company'...
li = [] nli = [] n = int(input()) for i in range(n): li.append(input()) nli.append([i]) a=0 #print(nli) for i in range(n-1): a,b = map(int,input().split()) a-=1 b-=1 nli[a]+=nli[b] nli[b] = [] res = "" for i in range(n): print(li[nli[a][i]],sep='',end='')
li = [] nli = [] n = int(input()) for i in range(n): li.append(input()) nli.append([i]) a = 0 for i in range(n - 1): (a, b) = map(int, input().split()) a -= 1 b -= 1 nli[a] += nli[b] nli[b] = [] res = '' for i in range(n): print(li[nli[a][i]], sep='', end='')
"""nbgrader_schema Revision ID: e43177bfe90b Revises: Create Date: 2021-09-11 04:07:31.804665+00:00 """ # revision identifiers, used by Alembic. revision = 'e43177bfe90b' down_revision = None branch_labels = None depends_on = None def upgrade(): pass def downgrade(): pass
"""nbgrader_schema Revision ID: e43177bfe90b Revises: Create Date: 2021-09-11 04:07:31.804665+00:00 """ revision = 'e43177bfe90b' down_revision = None branch_labels = None depends_on = None def upgrade(): pass def downgrade(): pass
#!/usr/bin/env python """ trie.py: contains the definition and declaration of the trie class """ __author__ = "Shivchander Sudalairaj" __email__ = "sudalasr@mail.uc.edu" class Trie: """ Trie/Prefix Tree data structure to efficiently load the dictionary of all valid words https://en.wikipedia.org/wiki/Tr...
""" trie.py: contains the definition and declaration of the trie class """ __author__ = 'Shivchander Sudalairaj' __email__ = 'sudalasr@mail.uc.edu' class Trie: """ Trie/Prefix Tree data structure to efficiently load the dictionary of all valid words https://en.wikipedia.org/wiki/Trie """ def __ini...
names = ['John', 'Mary'] print(names) names[0], names[1] = names[1], names[0] print(names)
names = ['John', 'Mary'] print(names) (names[0], names[1]) = (names[1], names[0]) print(names)
number = int(input()) for numbers in range(1111, 9999): is_Magic = True number_as_string = str(numbers) for digit in number_as_string: if int(digit) == 0: is_Magic = False break elif number % int(digit) != 0: is_Magic = False break if is_Ma...
number = int(input()) for numbers in range(1111, 9999): is__magic = True number_as_string = str(numbers) for digit in number_as_string: if int(digit) == 0: is__magic = False break elif number % int(digit) != 0: is__magic = False break if is...
def myfnc(x): print("inside myfnc", x) x = 10 print("inside myfnc", x) x = 20 myfnc(x) print(x)
def myfnc(x): print('inside myfnc', x) x = 10 print('inside myfnc', x) x = 20 myfnc(x) print(x)
class PDL1netTester: """ class represents a PDL1 net Tester """ def __init__(self): pass def test(self): pass # TODO: add here function to show results and compare different settings result
class Pdl1Nettester: """ class represents a PDL1 net Tester """ def __init__(self): pass def test(self): pass
class Solution: def reverse(self, x: int) -> int: self.setLimit(x) result = 0 while x != 0: tail: int = self.mod10(x) if self.overflow(result, tail): return 0 result = result * 10 + tail x = self.divide10(x) return resul...
class Solution: def reverse(self, x: int) -> int: self.setLimit(x) result = 0 while x != 0: tail: int = self.mod10(x) if self.overflow(result, tail): return 0 result = result * 10 + tail x = self.divide10(x) return resu...
del_items(0x80114B24) SetType(0x80114B24, "int NumOfMonsterListLevels") del_items(0x800A49E4) SetType(0x800A49E4, "struct MonstLevel AllLevels[16]") del_items(0x80114820) SetType(0x80114820, "unsigned char NumsLEV1M1A[4]") del_items(0x80114824) SetType(0x80114824, "unsigned char NumsLEV1M1B[4]") del_items(0x80114828) S...
del_items(2148616996) set_type(2148616996, 'int NumOfMonsterListLevels') del_items(2148157924) set_type(2148157924, 'struct MonstLevel AllLevels[16]') del_items(2148616224) set_type(2148616224, 'unsigned char NumsLEV1M1A[4]') del_items(2148616228) set_type(2148616228, 'unsigned char NumsLEV1M1B[4]') del_items(214861623...
class MinStack(object): def __init__(self): """ data structure . """ self.stack = [] self.minimum = None def push(self, x): """ :type x: int :rtype: None """ if len(self.stack) == 0: self.stack.append(x) ...
class Minstack(object): def __init__(self): """ data structure . """ self.stack = [] self.minimum = None def push(self, x): """ :type x: int :rtype: None """ if len(self.stack) == 0: self.stack.append(x) se...
# -*- coding: utf-8 -*- """ Algoritmo de busqueda binaria usando el ciclo while escrito en Python. Este metodo funciona con cadenas y numeros por igual, ya que el lenguaje trata a las cadenas lexicograficamente; comparando sus valores en el codigo ASCII """ def binary_search(list_data, search_data): left_index,...
""" Algoritmo de busqueda binaria usando el ciclo while escrito en Python. Este metodo funciona con cadenas y numeros por igual, ya que el lenguaje trata a las cadenas lexicograficamente; comparando sus valores en el codigo ASCII """ def binary_search(list_data, search_data): (left_index, right_index) = (0, len(l...
class Solution: def partitionLabels(self, S: str) -> List[int]: """ A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers repre...
class Solution: def partition_labels(self, S: str) -> List[int]: """ A string S of lowercase English letters is given. We want to partition this string into as many parts as possible so that each letter appears in at most one part, and return a list of integers representing...
''' a = qtd pistas 1 b = qtd pessoas por pistas 9 c = qtd alunos 4 ''' A, B, C = [int(x) for x in input().split()] if (A*B) > C: print("S") else: print("N")
""" a = qtd pistas 1 b = qtd pessoas por pistas 9 c = qtd alunos 4 """ (a, b, c) = [int(x) for x in input().split()] if A * B > C: print('S') else: print('N')
global file_object global min_country global max_country def open_file(): global file_object while True: # repeatedly prompting for a file name until if its valid file_name = input('Enter the file name: ') # checking if file can be opened try: file_objec...
global file_object global min_country global max_country def open_file(): global file_object while True: file_name = input('Enter the file name: ') try: file_object = open(file_name) break except: print('Error: file not Found') file_object...
""" Leetcode 1041 - Robot Bounded in Circle https://leetcode.com/problems/robot-bounded-in-circle/ """ class Solution1: """ 1. MINE Straight-Forward """ def is_robot_bounded(self, instructions: str) -> bool: nums = {'G': 0, 'R': 1, 'L': -1} direction = [1, -1] position = [0, 0] ...
""" Leetcode 1041 - Robot Bounded in Circle https://leetcode.com/problems/robot-bounded-in-circle/ """ class Solution1: """ 1. MINE Straight-Forward """ def is_robot_bounded(self, instructions: str) -> bool: nums = {'G': 0, 'R': 1, 'L': -1} direction = [1, -1] position = [0, 0] ...
_base_ = [ '../_base_/models/flownet2/flownet2sd.py', '../_base_/datasets/chairssdhom_384x448.py', '../_base_/schedules/schedule_s_long.py', '../_base_/default_runtime.py' ]
_base_ = ['../_base_/models/flownet2/flownet2sd.py', '../_base_/datasets/chairssdhom_384x448.py', '../_base_/schedules/schedule_s_long.py', '../_base_/default_runtime.py']
LOAD_CONTENT_CACHE = False # Uncomment following line if you want document-relative URLs when developing #RELATIVE_URLS = True
load_content_cache = False
number = int(input()) word = input() save = [] for i in range(number): current_string = input() save.append(current_string) print(save) for i in range(len(save) -1, -1, -1): element = save[i] if word not in element: save.remove(element) print(save)
number = int(input()) word = input() save = [] for i in range(number): current_string = input() save.append(current_string) print(save) for i in range(len(save) - 1, -1, -1): element = save[i] if word not in element: save.remove(element) print(save)
print("Enter the no of rows: ") n = int(input()) for i in range(n): count = 0 flag = 0 for j in range(n): if(i==j): flag = 1 if(flag==1): print(n-count, end=" ") count+=1 if(flag!=1): print("1",end=" ") print() # Enter the no o...
print('Enter the no of rows: ') n = int(input()) for i in range(n): count = 0 flag = 0 for j in range(n): if i == j: flag = 1 if flag == 1: print(n - count, end=' ') count += 1 if flag != 1: print('1', end=' ') print()
I=input k=int(I()) l=int(I()) r=1 while k**r<l:r+=1 print(['NO','YES\n'+str(r-1)][k**r==l])
i = input k = int(i()) l = int(i()) r = 1 while k ** r < l: r += 1 print(['NO', 'YES\n' + str(r - 1)][k ** r == l])
# Advance Lists my_list = [1, 2, 3] # Add element print('\n# Add element\n') my_list.append(4) my_list.append(4) print(my_list) # Count element's occurrences print('\n# Count element\'s occurrences\n') print(f'2 = {my_list.count(2)}') print(f'4 = {my_list.count(4)}') print(f'5 = {my_list.count(5)}') # Extend print...
my_list = [1, 2, 3] print('\n# Add element\n') my_list.append(4) my_list.append(4) print(my_list) print("\n# Count element's occurrences\n") print(f'2 = {my_list.count(2)}') print(f'4 = {my_list.count(4)}') print(f'5 = {my_list.count(5)}') print('\n# Extend\n') x = [1, 2, 3] x.append([4, 5]) print(f'Use append = {x}') ...
#!/usr/bin/env python # coding=utf-8 # author: zengyuetian content_type_json = {'Content-Type': 'application/json'} accept_type_json = {'Accept': 'application/json'} if __name__ == "__main__": pass
content_type_json = {'Content-Type': 'application/json'} accept_type_json = {'Accept': 'application/json'} if __name__ == '__main__': pass
# # %CopyrightBegin% # # Copyright Ericsson AB 2013. All Rights Reserved. # # The contents of this file are subject to the Erlang Public License, # Version 1.1, (the "License"); you may not use this file except in # compliance with the License. You should have received a copy of the # Erlang Public License along with t...
def get_thread_name(t): f = gdb.newest_frame() while f: if f.name() == 'async_main': return 'async' elif f.name() == 'erts_sys_main_thread': return 'main' elif f.name() == 'signal_dispatcher_thread_func': return 'signal_dispatcher' elif f.name(...
# 264. Ugly Number II # Runtime: 173 ms, faster than 54.94% of Python3 online submissions for Ugly Number II. # Memory Usage: 14.2 MB, less than 73.79% of Python3 online submissions for Ugly Number II. class Solution: # Three Pointers def nthUglyNumber(self, n: int) -> int: nums = [1] p2, p3...
class Solution: def nth_ugly_number(self, n: int) -> int: nums = [1] (p2, p3, p5) = (0, 0, 0) for _ in range(1, n): n2 = 2 * nums[p2] n3 = 3 * nums[p3] n5 = 5 * nums[p5] nums.append(min(n2, n3, n5)) if nums[-1] == n2: ...
class Constraints(object): ''' Contains all of the primary and foreign key constraint names for the given entity as tuples of entities and relations which are part of constraints ''' def __init__(self, pk_constraints, fk_constraints): self.pk_constraints = pk_constraints self.f...
class Constraints(object): """ Contains all of the primary and foreign key constraint names for the given entity as tuples of entities and relations which are part of constraints """ def __init__(self, pk_constraints, fk_constraints): self.pk_constraints = pk_constraints self.fk...
_base_ = [ '../_base_/models/du_pspnet_r50-d8.py', '../_base_/datasets/yantai_st12.py', '../_base_/runtimes/yantai_runtime.py', '../_base_/schedules/schedule_yantai.py' ] model = dict( decode_head=dict(num_classes=4), auxiliary_head=dict(num_classes=4)) test_cfg = dict(mode='whole')
_base_ = ['../_base_/models/du_pspnet_r50-d8.py', '../_base_/datasets/yantai_st12.py', '../_base_/runtimes/yantai_runtime.py', '../_base_/schedules/schedule_yantai.py'] model = dict(decode_head=dict(num_classes=4), auxiliary_head=dict(num_classes=4)) test_cfg = dict(mode='whole')
class Level: def __init__(self, ident, desc, nresources): self.id = ident self.description = desc self.networkResources = nresources
class Level: def __init__(self, ident, desc, nresources): self.id = ident self.description = desc self.networkResources = nresources
o = input() e = input() ans = '' for i in range(len(e)): ans += o[i] ans += e[i] if len(o)-len(e) == 1: ans += o[-1] print(ans)
o = input() e = input() ans = '' for i in range(len(e)): ans += o[i] ans += e[i] if len(o) - len(e) == 1: ans += o[-1] print(ans)
# from ..sims.deprecated.cat_mouse import data_visualizer as cat_mouse_vis # from ..sims.deprecated.route_choice import data_visualizer as route_choice_vis # from ..sims.deprecated.simple_migration import data_visualizer as simple_mig_vis """ @pytest.mark.skip(reason="deprecated") def test_cat_mouse_visualizer(): ...
""" @pytest.mark.skip(reason="deprecated") def test_cat_mouse_visualizer(): cat_mouse_vis.visualize(test=True) @pytest.mark.skip(reason="deprecated") def test_route_choice_visualizer(): route_choice_vis.visualize(test=True) @pytest.mark.skip(reason="deprecated") def test_simple_migration_visualizer(): s...
#!/usr/bin/python3 class colors: """Colored terminal outputs""" # Colors can be added and they will be loaded throughout the program # To output "test" in green: # print(colors.GREEN + "test" + colors.RESET) # print({1}test{0}.format(colors.RESET, colors.GREEN)) GREEN = '\033[92m' YELLOW = '\033[93m' BLUE = '\0...
class Colors: """Colored terminal outputs""" green = '\x1b[92m' yellow = '\x1b[93m' blue = '\x1b[94m' red = '\x1b[91m' bold = '\x1b[1m' reset = '\x1b[0m'
{ "targets": [{ "target_name": "mine.uv", "type": "executable", "dependencies": [ "mine.uv-lib", ], "sources": [ "src/main.c", ], }, { "target_name": "mine.uv-lib", "type": "<(library)", "include_dirs": [ "src" ], "dependencies": [ "deps/uv/uv.gyp:libuv", ...
{'targets': [{'target_name': 'mine.uv', 'type': 'executable', 'dependencies': ['mine.uv-lib'], 'sources': ['src/main.c']}, {'target_name': 'mine.uv-lib', 'type': '<(library)', 'include_dirs': ['src'], 'dependencies': ['deps/uv/uv.gyp:libuv', 'deps/openssl/openssl.gyp:openssl', 'deps/zlib/zlib.gyp:zlib'], 'direct_depend...
# # PySNMP MIB module CISCO-UNIFIED-COMPUTING-SYSFILE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-SYSFILE-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:17:44 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Usi...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
def duel1(a, b, c): k = 0 for _ in range(c): a = a * 16807 % 2147483647 b = b * 48271 % 2147483647 k += a & 0xffff == b & 0xffff return k def duel2(a, b, c): k = 0 for _ in range(c): a = a * 16807 % 2147483647 while a & 0x3: a = a * 16807 % 214748...
def duel1(a, b, c): k = 0 for _ in range(c): a = a * 16807 % 2147483647 b = b * 48271 % 2147483647 k += a & 65535 == b & 65535 return k def duel2(a, b, c): k = 0 for _ in range(c): a = a * 16807 % 2147483647 while a & 3: a = a * 16807 % 2147483647...
{ 'name': 'OpenERP Web Diagram', 'category': 'Hidden', 'description': """ Openerp Web Diagram view. ========================= """, 'version': '2.0', 'depends': ['web'], 'js': [ 'static/lib/js/raphael.js', 'static/lib/js/jquery.mousewheel.js', 'static/src/js/vec2.js', ...
{'name': 'OpenERP Web Diagram', 'category': 'Hidden', 'description': '\nOpenerp Web Diagram view.\n=========================\n\n', 'version': '2.0', 'depends': ['web'], 'js': ['static/lib/js/raphael.js', 'static/lib/js/jquery.mousewheel.js', 'static/src/js/vec2.js', 'static/src/js/graph.js', 'static/src/js/diagram.js']...
class Solution: def __init__(self): self.res = "" self.maxLen = 0 def naive(self,s): self.length = len(s) def loop(start,end): l,r = start,end while l>=0 and r<=self.length-1 and s[l]==s[r]: if r-l+1>self.maxLen: self.re...
class Solution: def __init__(self): self.res = '' self.maxLen = 0 def naive(self, s): self.length = len(s) def loop(start, end): (l, r) = (start, end) while l >= 0 and r <= self.length - 1 and (s[l] == s[r]): if r - l + 1 > self.maxLen: ...
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) def f(): (some_global): int print(some_global) # EXPECTED: [ ..., LOAD_CONST(Code((1, 0))), LOAD_CONST('f'), MAKE_FUNCTION(0), STORE_NAME('f'), LOAD_CONST(None), RETURN_VALUE(0), CODE_START('f'), ~L...
def f(): (some_global): int print(some_global) [..., load_const(code((1, 0))), load_const('f'), make_function(0), store_name('f'), load_const(None), return_value(0), code_start('f'), ~load_const('int')]
#This program computes compound interest #Prompt the user to input the inital investment C = int(input('Enter the initial amount of an investment(C): ')) #Prompt the user to input the yearly rate of interest r = float(input('Enter the yearly rate of interest(r): ')) #Prompt the user to input the number of years unti...
c = int(input('Enter the initial amount of an investment(C): ')) r = float(input('Enter the yearly rate of interest(r): ')) t = int(input('Enter the number of years until maturation(t): ')) n = int(input('Enter the number of times the interest is compounded per year(n): ')) p = str(round(C * (1 + r / n) ** (t * n), 2))...
{ "targets": [ { "target_name": "index", "sources": [ "epoc.cc"], "include_dirs" : [ "<!(node -e \"require('nan')\")" ], "conditions": [ ['OS=="mac"', { "cflags": [ "-m64" ], "ldflags": [ "-m64" ], "xcode_settings": { "OTHER_C...
{'targets': [{'target_name': 'index', 'sources': ['epoc.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'conditions': [['OS=="mac"', {'cflags': ['-m64'], 'ldflags': ['-m64'], 'xcode_settings': {'OTHER_CFLAGS': ['-ObjC++'], 'ARCHS': ['x86_64']}, 'link_settings': {'libraries': ['/Library/Frameworks/edk.framewor...
SAMPLE_DATASET = """GATATATGCATATACTT ATAT """ SAMPLE_OUTPUT = """2 4 10""" def kmer_generator(string, n): """returns a generator for kmers of length n""" return (string[i : i + n] for i in range(0, len(string))) def solution(dataset: list) -> str: s, t = map(lambda x: x.strip(), dataset) # clean l...
sample_dataset = 'GATATATGCATATACTT\nATAT\n' sample_output = '2 4 10' def kmer_generator(string, n): """returns a generator for kmers of length n""" return (string[i:i + n] for i in range(0, len(string))) def solution(dataset: list) -> str: (s, t) = map(lambda x: x.strip(), dataset) locs = [str(i) for...
"""Some utility functions module.""" def camel_to_snake(s): """ converts CamelCase string to camel_case\ taken from https://stackoverflow.com/a/44969381 :param s: some string :type s: str: :return: a camel_case string :rtype: str: """ no_camel = ''.join(['_'+c.low...
"""Some utility functions module.""" def camel_to_snake(s): """ converts CamelCase string to camel_case taken from https://stackoverflow.com/a/44969381 :param s: some string :type s: str: :return: a camel_case string :rtype: str: """ no_camel = ''.join(['_' + c.lowe...
""" ranges from taking the first k to taking the last k, so try all the combinations, shifting one numbr at a time """ class Solution: def maxScore(self, cardPoints: List[int], k: int) -> int: max_score = curr_score = sum(cardPoints[:k]) for i in range(1, k+1): curr_score += cardPoints[...
""" ranges from taking the first k to taking the last k, so try all the combinations, shifting one numbr at a time """ class Solution: def max_score(self, cardPoints: List[int], k: int) -> int: max_score = curr_score = sum(cardPoints[:k]) for i in range(1, k + 1): curr_score += cardPoi...
class IdentityHolder: """ Wraps an object so that it can be quickly compared by object identity rather than value. Also provides a total order based on object address. This is frequently useful for sets representing cycles: set value equality is O(n) but object identity equality is O(1). Different ...
class Identityholder: """ Wraps an object so that it can be quickly compared by object identity rather than value. Also provides a total order based on object address. This is frequently useful for sets representing cycles: set value equality is O(n) but object identity equality is O(1). Different ...
def uniqueOccurrences(self, arr: List[int]) -> bool: m = {} for i in arr: if i in m: m[i] += 1 else: m[i] = 1 return len(m.values()) == len(set(m.values()))
def unique_occurrences(self, arr: List[int]) -> bool: m = {} for i in arr: if i in m: m[i] += 1 else: m[i] = 1 return len(m.values()) == len(set(m.values()))
# leetcode class Solution: def hammingDistance(self, x: int, y: int) -> int: ans = 0 xor = bin(x^y)[2:] for l in xor: if l == '1': ans += 1 return ans
class Solution: def hamming_distance(self, x: int, y: int) -> int: ans = 0 xor = bin(x ^ y)[2:] for l in xor: if l == '1': ans += 1 return ans
''' Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l. Here are some examples to show how your function should work. >>> sumprimes([3,3,1,13]) 19 ''' def sumprimes(l): prime_sum = int() for num in l: if is_prime(num): ...
""" Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l. Here are some examples to show how your function should work. >>> sumprimes([3,3,1,13]) 19 """ def sumprimes(l): prime_sum = int() for num in l: if is_prime(num): ...
''' date : 31/03/2020 description : this module keeps information on print objects used by editor author : Celray James CHAWANDA contact : celray.chawanda@outlook.com licence : MIT 2020 ''' print_obj_lookup = { "basin_wb" : "1", "basin_nb" : "2", "basin_ls" : "3", "ba...
""" date : 31/03/2020 description : this module keeps information on print objects used by editor author : Celray James CHAWANDA contact : celray.chawanda@outlook.com licence : MIT 2020 """ print_obj_lookup = {'basin_wb': '1', 'basin_nb': '2', 'basin_ls': '3', 'basin_pw': '4', 'basin_...
load("//scala:scala_cross_version.bzl", "scala_mvn_artifact", ) def specs2_version(): return "3.8.8" def specs2_repositories(): native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_core", artifact = scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version()), sha1 = "495bed0...
load('//scala:scala_cross_version.bzl', 'scala_mvn_artifact') def specs2_version(): return '3.8.8' def specs2_repositories(): native.maven_jar(name='io_bazel_rules_scala_org_specs2_specs2_core', artifact=scala_mvn_artifact('org.specs2:specs2-core:' + specs2_version()), sha1='495bed00c73483f4f5f43945fde63c615d...
class Solution: def XXX(self, nums: List[int]) -> List[List[int]]: l = len(nums) if l <= 1: return [nums] total = 1 for i in range(2, l + 1): total *= i res = [[] for _ in range(total)] div = total for i in range(l): ni = nu...
class Solution: def xxx(self, nums: List[int]) -> List[List[int]]: l = len(nums) if l <= 1: return [nums] total = 1 for i in range(2, l + 1): total *= i res = [[] for _ in range(total)] div = total for i in range(l): ni = n...
#Program for merge sort in linked list class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def append(self, new_value): new_node = Node(new_value) if self.head is None: self.head = new_node return curr_node = self.head ...
class Node: def __init__(self, data): self.data = data self.next = None class Linkedlist: def __init__(self): self.head = None def append(self, new_value): new_node = node(new_value) if self.head is None: self.head = new_node return ...
''' CoG application-level constants. ''' SECTION_DEFAULT = 'DEFAULT' SECTION_ESGF = 'ESGF' SECTION_EMAIL = 'EMAIL' SECTION_GLOBUS = 'GLOBUS' SECTION_PID = 'PID' # note: use lower case VALID_MIME_TYPES = { '.bmp': ['image/bmp', 'image/x-windows-bmp'], '.csv': ['text/plain'], ...
""" CoG application-level constants. """ section_default = 'DEFAULT' section_esgf = 'ESGF' section_email = 'EMAIL' section_globus = 'GLOBUS' section_pid = 'PID' valid_mime_types = {'.bmp': ['image/bmp', 'image/x-windows-bmp'], '.csv': ['text/plain'], '.doc': ['application/msword'], '.docx': ['application/msword', 'appl...
"""The exception for the rayvision api.""" class RayvisionError(Exception): """Raise RayvisionError if something wrong.""" def __init__(self, error_code, error, *args, **kwargs): """Initialize error message, inherited Exception. Args: error_code (int): Error status code. ...
"""The exception for the rayvision api.""" class Rayvisionerror(Exception): """Raise RayvisionError if something wrong.""" def __init__(self, error_code, error, *args, **kwargs): """Initialize error message, inherited Exception. Args: error_code (int): Error status code. ...
#!/usr/bin/env python # coding: utf-8 # --- # # Python Basics - Assingment 3 ToDo # # --- # **Exercise 1** # # **Task 1** Define a function called **repeat_stuff** that takes in two inputs, **stuff**, and **num_repeats**. # # We will want to make this function print a string with stuff repeated num_repeats amount o...
def repeat_stuff(stuff, num_repeats): for i in range(num_repeats): print(stuff) repeat_stuff(input('Input an word: '), int(input('Repeat how many times? '))) def repeat_stuff(stuff, num_repeats): return stuff * num_repeats repeat_stuff(input('Input an word: '), int(input('Repeat how many times? '))) d...
sessions = [{ "1": { "type": "session", "source": {"id": "scope"}, "id": "1", 'profile': {"id": "1"} } }] profiles = [ {"1": {'id': "1", "traits": {}}}, {"2": {'id': "2", "traits": {}}}, ] class MockStorageCrud: def __init__(self, index, domain_class_ref, entity):...
sessions = [{'1': {'type': 'session', 'source': {'id': 'scope'}, 'id': '1', 'profile': {'id': '1'}}}] profiles = [{'1': {'id': '1', 'traits': {}}}, {'2': {'id': '2', 'traits': {}}}] class Mockstoragecrud: def __init__(self, index, domain_class_ref, entity): self.index = index self.domain_class_ref...
# Configuration file for opasDataLoader default_build_pattern = "(bEXP_ARCH1|bSeriesTOC)" default_process_pattern = "(bKBD3|bSeriesTOC)" # Global variables (for data and instances) options = None # Source codes (books/journals) which should store paragraphs SRC_CODES_TO_INCLUDE_PARAS = ["GW", "SE"] # for these code...
default_build_pattern = '(bEXP_ARCH1|bSeriesTOC)' default_process_pattern = '(bKBD3|bSeriesTOC)' options = None src_codes_to_include_paras = ['GW', 'SE'] data_update_prepublication_codes_to_ignore = ['IPL', 'ZBK', 'NLP', 'SE', 'GW']
""" Custom Exceptions """ __author__ = "Alastair Tse <alastair@tse.id.au>" __license__ = "BSD" __copyright__ = "Copyright (c) 2004, Alastair Tse" __revision__ = "$Id: exceptions.py,v 1.2 2004/05/04 12:18:21 acnt2 Exp $" class ID3Exception(Exception): """General ID3Exception""" pass class ID3EncodingException(ID3...
""" Custom Exceptions """ __author__ = 'Alastair Tse <alastair@tse.id.au>' __license__ = 'BSD' __copyright__ = 'Copyright (c) 2004, Alastair Tse' __revision__ = '$Id: exceptions.py,v 1.2 2004/05/04 12:18:21 acnt2 Exp $' class Id3Exception(Exception): """General ID3Exception""" pass class Id3Encodingexception(...
class Recommendation: def __init__(self, title): self.title = title self.wikidata_id = None self.rank = None self.pageviews = None self.url = None self.sitelink_count = None def __dict__(self): return dict(title=self.title, wikidata_id...
class Recommendation: def __init__(self, title): self.title = title self.wikidata_id = None self.rank = None self.pageviews = None self.url = None self.sitelink_count = None def __dict__(self): return dict(title=self.title, wikidata_id=self.wikidata_id, ...
# coding=utf8 # # OOO$QHHHQ$$$$$$$$$QQQHHHHNHHHNNNNNNNNNNN # OO$$QHHNHQ$$$$$O$$$QQQHHHNNHHHNNNNNNMNNN # $$$QQHHHH$$$OOO$$$$QQQQHHHHHHHNHNNNMNNNN # HHQQQHHH--:!OOO$$$QQQQQQQHHHHHNNNNNNNNNN # NNNHQHQ-;-:-:O$$$$$QQQ$QQQQHHHHNNNNNNNNN # NMNHHQ;-;----:$$$$$$$:::OQHHHHHNNNNHHNNN # NNNHH;;;-----:C$$$$$::----::-::>NNNNNNNN # N...
"""global vars""" version = '0.3.9' charset = 'utf8' src_ext = '.md' out_ext = '.html' src_dir = 'src' out_dir = '.'
class Category: def __init__(self, category): self.name = category self.ledger = [] # Each entry is a dictionary self.ledger1 = [] # Each entry is an array self.balance = 0 self.withdrawals = 0 def deposit(self, amt, desc=""): self.balance += amt self....
class Category: def __init__(self, category): self.name = category self.ledger = [] self.ledger1 = [] self.balance = 0 self.withdrawals = 0 def deposit(self, amt, desc=''): self.balance += amt self.ledger.append({'amount': amt, 'description': desc}) ...
def extractExpandablefemaleBlogspotCom(item): ''' DISABLED Parser for 'expandablefemale.blogspot.com' ''' return None
def extract_expandablefemale_blogspot_com(item): """ DISABLED Parser for 'expandablefemale.blogspot.com' """ return None
# -*- coding: utf-8 -*- """ Impact @author: Michael Howden (michael@sahanafoundation.org) @date-created: 2010-10-12 Impact resources used by I(ncident)RS and Assessment """ module = "impact" if deployment_settings.has_module("irs") or deployment_settings.has_module("assess"): # ---...
""" Impact @author: Michael Howden (michael@sahanafoundation.org) @date-created: 2010-10-12 Impact resources used by I(ncident)RS and Assessment """ module = 'impact' if deployment_settings.has_module('irs') or deployment_settings.has_module('assess'): resourcename = 'type' tablename = '%s_%s...
# -*- coding: utf-8 -*- # pyxliff/__init__.py """Provides useful functions for SDLXliff terms verification and discovery.""" __version__ = "0.1.0"
"""Provides useful functions for SDLXliff terms verification and discovery.""" __version__ = '0.1.0'
class NanoblocksClass: """ Global class that should be inherited by any Nanoblocks class that requires access to the network. """ def __init__(self, nano_network): self._nano_network = nano_network @property def network(self): return self._nano_network @property def n...
class Nanoblocksclass: """ Global class that should be inherited by any Nanoblocks class that requires access to the network. """ def __init__(self, nano_network): self._nano_network = nano_network @property def network(self): return self._nano_network @property def no...
# # PySNMP MIB module ZYXEL-L3-IP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-L3-IP-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:50:32 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ...
##planets = [ ## { ## "planet": "Tatooine", ## "visited": False, ## "reachable": ["Dagobah", "Hoth"] ## }, ## { ## "planet": "Dagobah", ## "visited": False, ## "reachable": ["Hoth", "Endor"] ## }, ## { ## "planet": "Endor", ## "visited": False, ## ...
mylist = [{'trajectory': ['Tatooine', 'Hoth', 'Endor'], 'total_time': 7, 'caught_proba': 0.19}, {'trajectory': ['Tatooine', 'Hoth', 'Endor'], 'total_time': 7, 'caught_proba': 0.18}, {'trajectory': ['Tatooine', 'Hoth', 'Endor'], 'total_time': 7, 'caught_proba': 0}] def take_caught_proba(elem): return elem['caught_p...
# -*- coding: utf-8 -*- def main(): n, m = map(int, input().split()) xs = sorted(list(map(int, input().split()))) if n >= m: print(0) else: ans = xs[-1] - xs[0] diff = [0 for _ in range(m - 1)] for i in range(m - 1): diff[i] = xs[i + 1] - xs[...
def main(): (n, m) = map(int, input().split()) xs = sorted(list(map(int, input().split()))) if n >= m: print(0) else: ans = xs[-1] - xs[0] diff = [0 for _ in range(m - 1)] for i in range(m - 1): diff[i] = xs[i + 1] - xs[i] print(ans - sum(sorted(diff, ...
if True: pass if 0: pass if 1: pass if (1==1) : pass if 1 == 2 + - 1 : pass if 456 == 244: pass if 1 == 0 - 5 + 6 - 1: pass if 2 + 2 == 5: pass if 23313 + 31313 == 0: pass if 2 + 2 == 3 + 1 * 0 + 1 : pass if 1 == 1: pass if - 1== 2-3 : pass if (2 + 2) + 2 == 7: ...
if True: pass if 0: pass if 1: pass if 1 == 1: pass if 1 == 2 + -1: pass if 456 == 244: pass if 1 == 0 - 5 + 6 - 1: pass if 2 + 2 == 5: pass if 23313 + 31313 == 0: pass if 2 + 2 == 3 + 1 * 0 + 1: pass if 1 == 1: pass if -1 == 2 - 3: pass if 2 + 2 + 2 == 7: pass if 55 ...
# # PySNMP MIB module ALCATEL-IND1-IPX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IPX-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:02:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(routing_ind1_ipx,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'routingIND1Ipx') (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, const...
command = input() command = command.strip() tokens = [] numbers = ['0','1','2','3','4','5','6','7','9'] if (command[:4]=="cout" and command[-1]==';'): index = 4 while(True): if(command[index]=='<' and command[index+1]=='<'): index+=2 s="" while(command[index]!='<' and...
command = input() command = command.strip() tokens = [] numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '9'] if command[:4] == 'cout' and command[-1] == ';': index = 4 while True: if command[index] == '<' and command[index + 1] == '<': index += 2 s = '' while comma...
""" Source: https://en.wikipedia.org/wiki/Palindrome#Names """ def is_palindrome(text: str) -> bool: return text.lower() == text.lower()[::-1] if __name__=='__main__': text = input('Give me the text to analyze: ') print(f'{text} Is Palindrome?: {is_palindrome(text)}')
""" Source: https://en.wikipedia.org/wiki/Palindrome#Names """ def is_palindrome(text: str) -> bool: return text.lower() == text.lower()[::-1] if __name__ == '__main__': text = input('Give me the text to analyze: ') print(f'{text} Is Palindrome?: {is_palindrome(text)}')
result = { "due-date": "2018-11-13T00:00:00", "features": [ { "geometry": { "coordinates": [ [ [ 9.52487, 46.85514 ], [ ...
result = {'due-date': '2018-11-13T00:00:00', 'features': [{'geometry': {'coordinates': [[[9.52487, 46.85514], [9.52212, 46.8517], [9.52433, 46.84804], [9.53032, 46.84769], [9.53377, 46.85042], [9.53482, 46.85252], [9.53253, 46.85529], [9.52487, 46.85514]]], 'type': 'Polygon'}, 'properties': {'grade': 'B', 'uic_ref': 1}...
#!/usr/bin/env python # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Michael A.G. Aivazis # California Institute of Technology # (C) 1998-2005 All Rights Reserved # # {LicenseText} # # ~~~~~~~~~~~~~~~~~~~~~~~~...
def keyboard_attributes(object): def identify(self, inspector): return inspector.onKeyboardAttributes(self) def __init__(self): self.accesskey = '' self.tabindex = '' return __id__ = '$Id: KeyboardAttributes.py,v 1.1 2005/03/20 07:22:58 aivazis Exp $'
# -*- coding: utf-8 -*- """ Created on Sun Jul 5 16:32:17 2020 Write a Python function that returns a list of keys in aDict that map to integer values that are unique (i.e. values appear exactly once in aDict). The list of keys you return should be sorted in increasing order. (If aDict does not contain any unique v...
""" Created on Sun Jul 5 16:32:17 2020 Write a Python function that returns a list of keys in aDict that map to integer values that are unique (i.e. values appear exactly once in aDict). The list of keys you return should be sorted in increasing order. (If aDict does not contain any unique values, you should return...
class Solution: def findLHS(self, nums: list) -> int: nums.sort() start_index = 0 l_count = 0 m_count = 0 LHS = 0 for i in range(len(nums)): if start_index == 0: l_count = 1 min_num = nums[i] start_index = 1...
class Solution: def find_lhs(self, nums: list) -> int: nums.sort() start_index = 0 l_count = 0 m_count = 0 lhs = 0 for i in range(len(nums)): if start_index == 0: l_count = 1 min_num = nums[i] start_index = ...
MAX_WORD_SENTENCE = 40 # VECTORIZATIONS TDIDF_EMBEDDING = 'tdidf' TOKENIZER = 'tokenizer' # IMBALANCE SMOTE_IMBALANCE = 'smote' # DATASET TYPES FINANCIAL_DATASET = 'financial_phrases_bank' MOVIE_DATASET = 'movie_data' SST_DATASET = 'sst_dataset' TWITTER_DATASET = 'twitter_data' YAHOO_DATASET = 'yahoo_data' NN_DATASE...
max_word_sentence = 40 tdidf_embedding = 'tdidf' tokenizer = 'tokenizer' smote_imbalance = 'smote' financial_dataset = 'financial_phrases_bank' movie_dataset = 'movie_data' sst_dataset = 'sst_dataset' twitter_dataset = 'twitter_data' yahoo_dataset = 'yahoo_data' nn_dataset = 'nn_dataset' polyglon_dataset = 'polyglon_da...
__all__ = [ 'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19', ] model_urls = { 'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth', 'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth', 'vgg16': 'https://download.pytorch.org/model...
__all__ = ['VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19'] model_urls = {'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth', 'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth', 'vgg16': 'https://download.pytorch.org/models/vgg16-397923af.pth', 'vg...
class BaseDriver(object): EXECUTABLE_PATH = None BINARY_PATH = None def __init__(self): self._driver = None @property def driver(self): return self._driver
class Basedriver(object): executable_path = None binary_path = None def __init__(self): self._driver = None @property def driver(self): return self._driver
# 2019-02-18 # sentence to dictionary meaning sentence = "It is truth universally acknowledged" f = open('dict_test.TXT', 'r', encoding='utf-8') dictionary = {} for line in f: word = line[:-1].split(" : ", 1) dictionary.update({word[0]:word[-1]}) f.close() print("Sentence :", sentence) for word in senten...
sentence = 'It is truth universally acknowledged' f = open('dict_test.TXT', 'r', encoding='utf-8') dictionary = {} for line in f: word = line[:-1].split(' : ', 1) dictionary.update({word[0]: word[-1]}) f.close() print('Sentence :', sentence) for word in sentence.split(' '): print(word.lower(), ':', dictiona...
def calcIoU(rectA, rectB): """Calculate IoU for two rectangles. Args: rectA: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]). rectB: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]). Returns: Returns IoU, intersection area, r...
def calc_io_u(rectA, rectB): """Calculate IoU for two rectangles. Args: rectA: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]). rectB: Rectangular bounding box ([top left X, top left Y, bottom right X, bottom right Y]). Returns: Returns IoU, intersection area, rec...
class MultiCollector(object): 'a collector combining multiple other collectors' def __init__(self): self._collectors = {} def register(self, name, collector): self._collectors[name] = collector def start(self): for name in self._collectors: self._collectors[name]....
class Multicollector(object): """a collector combining multiple other collectors""" def __init__(self): self._collectors = {} def register(self, name, collector): self._collectors[name] = collector def start(self): for name in self._collectors: self._collectors[nam...
# Set number of participants num_dyads = 4 num_participants = num_dyads*2 # Create lists for iterations participants = list(range(num_participants)) dyads = list(range(num_dyads))
num_dyads = 4 num_participants = num_dyads * 2 participants = list(range(num_participants)) dyads = list(range(num_dyads))
class Node(object): def Class(self): """ self.Class() -> Class of node. @return: Class of node. """ # raise NotImplementedError("This function is not written yet. Please put in an issue on the github page.") return "%s(%r)" % (self.__class__, self.__dict__) def ...
class Node(object): def class(self): """ self.Class() -> Class of node. @return: Class of node. """ return '%s(%r)' % (self.__class__, self.__dict__) def __getitem__(self): """ x.__getitem__(y) <==> x[y] """ raise not_implemented_error('T...
__all__ = ['v1', 'f1', 'C1'] v1 = 18 v2 = 36 def f1(): pass def f2(): pass class C1(object): pass class C2(object): pass
__all__ = ['v1', 'f1', 'C1'] v1 = 18 v2 = 36 def f1(): pass def f2(): pass class C1(object): pass class C2(object): pass
values = { 'r': 0.000000000001 } typers = { 'r': float } def setGlobal(key, value): values[key] = value
values = {'r': 1e-12} typers = {'r': float} def set_global(key, value): values[key] = value
""" Settings for tests. """ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'example.sqlite', }, } INSTALLED_APPS = [ 'tests.django_app' ] MIDDLEWARE_CLASSES = () SECRET_KEY = 'testing.'
""" Settings for tests. """ databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'example.sqlite'}} installed_apps = ['tests.django_app'] middleware_classes = () secret_key = 'testing.'
class UnsupportedMethod(Exception): def __init__(self, message, errors): super().__init__(message) class NoPayload(Exception): def __init__(self): super().__init__()
class Unsupportedmethod(Exception): def __init__(self, message, errors): super().__init__(message) class Nopayload(Exception): def __init__(self): super().__init__()
def print_multiplication_table(vertical_interval, horizontal_interval): print('\t', end='') for i in range(horizontal_interval[0], horizontal_interval[1] + 1): print(i, end='\t') print() for i in range(vertical_interval[0], vertical_interval[1] + 1): print(i, end='\t') for j in ...
def print_multiplication_table(vertical_interval, horizontal_interval): print('\t', end='') for i in range(horizontal_interval[0], horizontal_interval[1] + 1): print(i, end='\t') print() for i in range(vertical_interval[0], vertical_interval[1] + 1): print(i, end='\t') for j in r...
class Colors: def __init__(self): self.color_dict = { "ERROR": ';'.join([str(7), str(31), str(47)]), "WARN": ';'.join([str(7), str(33), str(40)]), "INFO": ';'.join([str(7), str(32), str(40)]), "GENERAL": ';'.join([str(7), str(34), str(47)]) } ...
class Colors: def __init__(self): self.color_dict = {'ERROR': ';'.join([str(7), str(31), str(47)]), 'WARN': ';'.join([str(7), str(33), str(40)]), 'INFO': ';'.join([str(7), str(32), str(40)]), 'GENERAL': ';'.join([str(7), str(34), str(47)])} def get_cformat(self, message_type): return self.colo...
def globals(request): #import pdb #pdb.set_trace() data = {} if 'menu_item' in request.session: data['menu_item'] = request.session['menu_item'] return data
def globals(request): data = {} if 'menu_item' in request.session: data['menu_item'] = request.session['menu_item'] return data
SQLALCHEMY_DATABASE_URI = \ 'mysql+cymysql://root:00000000@localhost/ucar' SECRET_KEY = '***' SQLALCHEMY_TRACK_MODIFICATIONS = True MINA_APP = { 'AppID': '***', 'AppSecret': '***' }
sqlalchemy_database_uri = 'mysql+cymysql://root:00000000@localhost/ucar' secret_key = '***' sqlalchemy_track_modifications = True mina_app = {'AppID': '***', 'AppSecret': '***'}
#!/usr/bin/env python def upgradeDriverCfg(version, dValue={}, dOption=[]): """Upgrade the config given by the dict dValue and dict dOption to the latest version.""" # the dQuantUpdate dict contains rules for replacing missing quantities dQuantReplace = {} # update quantities depending on version ...
def upgrade_driver_cfg(version, dValue={}, dOption=[]): """Upgrade the config given by the dict dValue and dict dOption to the latest version.""" d_quant_replace = {} if version == '1.0': version = '1.1' dValue['Enable demodulation'] = True return (version, dValue, dOption, dQuantRep...
class Class: def __init__(self, name: str): self.name = name class Instance: def __init__(self, cls: Class): self.cls = cls self._fields = {} def get_attr(self, name: str): if name not in self._fields: raise AttributeError(f"'{self.cls.name}' has no attribute {...
class Class: def __init__(self, name: str): self.name = name class Instance: def __init__(self, cls: Class): self.cls = cls self._fields = {} def get_attr(self, name: str): if name not in self._fields: raise attribute_error(f"'{self.cls.name}' has no attribute...
# Pell Numbers class Pell: def __init__(self): self.limiter = 1000 self.numbers = [0, 1] self.path = r'./Pell_Sequence/results.txt' def void(self): with open(self.path, "w+") as file: for i in range(self.limiter): self.numbers.append(2 * sel...
class Pell: def __init__(self): self.limiter = 1000 self.numbers = [0, 1] self.path = './Pell_Sequence/results.txt' def void(self): with open(self.path, 'w+') as file: for i in range(self.limiter): self.numbers.append(2 * self.numbers[i + 1] + self.n...
def squares(n): i = 1 while i <= n: yield i * i i += 1 print(list(squares(5)))
def squares(n): i = 1 while i <= n: yield (i * i) i += 1 print(list(squares(5)))
def prod(L): p = 1 for i in L: p *= i return p
def prod(L): p = 1 for i in L: p *= i return p
# a,b = [set(input().split()) for i in range(4)][1::2] # print ('\n'.join(sorted(a^b, key=int))) a,b=(int(input()),input().split()) c,d=(int(input()),input().split()) x=set(b) y=set(d) p=y.difference(x) q=x.difference(y) r=p.union(q) print ('\n'.join(sorted(r, key=int)))
(a, b) = (int(input()), input().split()) (c, d) = (int(input()), input().split()) x = set(b) y = set(d) p = y.difference(x) q = x.difference(y) r = p.union(q) print('\n'.join(sorted(r, key=int)))
def f(bar): # type: (str) -> str return bar f(bytearray())
def f(bar): return bar f(bytearray())
# job_list_one_shot.py --- # # Filename: job_list_one_shot.py # Author: Abhishek Udupa # Created: Tue Jan 26 15:13:19 2016 (-0500) # # # Copyright (c) 2015, Abhishek Udupa, University of Pennsylvania # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permit...
[(['python3', 'solvers.py', '--anytime', '3600', 'icfp', '../benchmarks/icfp/icfp_103_10.sl'], 'icfp_103_10-anytime', 'icfp_103_10-anytime'), (['python3', 'solvers.py', '--anytime', '3600', 'icfp', '../benchmarks/icfp/icfp_113_1000.sl'], 'icfp_113_1000-anytime', 'icfp_113_1000-anytime'), (['python3', 'solvers.py', '--a...