content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Heap class Solution: def shortestPathLength(self, graph): memo, final, q = set(), (1 << len(graph)) - 1, [(0, i, 1 << i) for i in range(len(graph))] while q: steps, node, state = heapq.heappop(q) if state == final: return steps for v in graph[node]: ...
class Solution: def shortest_path_length(self, graph): (memo, final, q) = (set(), (1 << len(graph)) - 1, [(0, i, 1 << i) for i in range(len(graph))]) while q: (steps, node, state) = heapq.heappop(q) if state == final: return steps for v in graph[n...
""" Conf file for base_url """ base_url = "http://qxf2trainer.pythonanywhere.com/accounts/login/"
""" Conf file for base_url """ base_url = 'http://qxf2trainer.pythonanywhere.com/accounts/login/'
def test_besthit(): assert False def test_get_term(): assert False def test_get_ancestors(): assert False def test_search(): assert False def test_suggest(): assert False def test_select(): assert False
def test_besthit(): assert False def test_get_term(): assert False def test_get_ancestors(): assert False def test_search(): assert False def test_suggest(): assert False def test_select(): assert False
# # PySNMP MIB module VISM-SESSION-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VISM-SESSION-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:27:36 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_intersection, single_value_constraint, constraints_union, value_size_constraint) ...
""" This module contains a function that loads previous trained classifier into the nlp unit. """ def loadClassif(nlp, app_path): """ This function loads the already trained classifier into the nlp unit. If the classifier does not yet exist, it will be trained as part of this function. Input: ...
""" This module contains a function that loads previous trained classifier into the nlp unit. """ def load_classif(nlp, app_path): """ This function loads the already trained classifier into the nlp unit. If the classifier does not yet exist, it will be trained as part of this function. Input: ...
#--------------------------------- # PIPELINE RUN #--------------------------------- # The configuration settings to run the pipeline. These options are overwritten # if a new setting is specified as an argument when running the pipeline. # These settings include: # - logDir: The directory where the batch queue scripts...
pipeline = {'logDir': 'log', 'logFile': 'pipeline_commands.log', 'style': 'print', 'procs': 16, 'verbose': 2, 'end': ['fastQCSummary', 'voom', 'edgeR', 'qcSummary'], 'force': [], 'rebuild': 'fromstart', 'manager': 'slurm'} using_merri = True maximal_rebuild_mode = True analysis_name = 'analysis_v1' raw_seq_dir = '/path...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here t = int(input()) def num_glowing(n, prime...
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ t = int(input()) def num_glowing(n, primes): if len(primes) ==...
class DesignOpt: def __init__(mesh, dofManager, quadRule): self.mesh = mesh self.dofManager = dofManager self.quadRule = quadRule
class Designopt: def __init__(mesh, dofManager, quadRule): self.mesh = mesh self.dofManager = dofManager self.quadRule = quadRule
__author__ = 'rhoerbe' #2013-09-05 # Entity Categories specifying the PVP eGov Token as of "PVP2-Allgemein V2.1.0", http://www.ref.gv.at/ EGOVTOKEN = ["PVP-VERSION", "PVP-PRINCIPAL-NAME", "PVP-GIVENNAME", "PVP-BIRTHDATE", "PVP-USERID", "PVP-GID", ...
__author__ = 'rhoerbe' egovtoken = ['PVP-VERSION', 'PVP-PRINCIPAL-NAME', 'PVP-GIVENNAME', 'PVP-BIRTHDATE', 'PVP-USERID', 'PVP-GID', 'PVP-BPK', 'PVP-MAIL', 'PVP-TEL', 'PVP-PARTICIPANT-ID', 'PVP-PARTICIPANT-OKZ', 'PVP-OU-OKZ', 'PVP-OU', 'PVP-OU-GV-OU-ID', 'PVP-FUNCTION', 'PVP-ROLES'] chargeattr = ['PVP-INVOICE-RECPT-ID',...
# classes for inline and reply keyboards class InlineButton: def __init__(self, text_, callback_data_ = "", url_=""): self.text = text_ self.callback_data = callback_data_ self.url = url_ if not self.callback_data and not self.url: raise TypeError("Either callback_data ...
class Inlinebutton: def __init__(self, text_, callback_data_='', url_=''): self.text = text_ self.callback_data = callback_data_ self.url = url_ if not self.callback_data and (not self.url): raise type_error('Either callback_data or url must be given') def __str__(s...
def rank4_simple(a, b): assert a.shape == b.shape da, db, dc, dd = a.shape s = 0 for iia in range(da): for iib in range(db): for iic in range(dc): for iid in range(dd): s += a[iia, iib, iic, iid] * b[iia, iib, iic, iid] return s
def rank4_simple(a, b): assert a.shape == b.shape (da, db, dc, dd) = a.shape s = 0 for iia in range(da): for iib in range(db): for iic in range(dc): for iid in range(dd): s += a[iia, iib, iic, iid] * b[iia, iib, iic, iid] return s
# # PySNMP MIB module CNTEXT-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CNTEXT-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:25:29 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:...
(cnt_ext,) = mibBuilder.importSymbols('APENT-MIB', 'cntExt') (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, constra...
def get_dict_pos(lst, key, value): return next((index for (index, d) in enumerate(lst) if d[key] == value), None) def search_engine(search_term, data_key, data): a = filter(lambda search_found: search_term in search_found[data_key], data) return list(a)
def get_dict_pos(lst, key, value): return next((index for (index, d) in enumerate(lst) if d[key] == value), None) def search_engine(search_term, data_key, data): a = filter(lambda search_found: search_term in search_found[data_key], data) return list(a)
""" This module contains submodules used to mine Interaction data from `Kegg`, `Hprd`, `InnateDB`, `BioPlex` and `Pina2` along with other data processing modules. The `features` module contains a function to compute the features based on two `:class:`.database.models.Protein`s. The `uniprot` module contains s...
""" This module contains submodules used to mine Interaction data from `Kegg`, `Hprd`, `InnateDB`, `BioPlex` and `Pina2` along with other data processing modules. The `features` module contains a function to compute the features based on two `:class:`.database.models.Protein`s. The `uniprot` module contains several...
# # PySNMP MIB module F10-BPSTATS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/F10-BPSTATS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:11:15 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- #3.1.1 => updates from 2016 to 2018 #3.1.2 => fix to pip distribution __version__ = '3.1.2'
__version__ = '3.1.2'
if __name__ == '__main__': print("{file} is main".format(file=__file__)) else: print("{file} is loaded".format(file=__file__))
if __name__ == '__main__': print('{file} is main'.format(file=__file__)) else: print('{file} is loaded'.format(file=__file__))
class Config: """Discriminator configurations. """ def __init__(self, steps: int): """Initializer. Args: steps: diffusion steps. """ self.steps = steps # embedding self.pe = 128 self.embeddings = 512 self.mappers = 2 # blo...
class Config: """Discriminator configurations. """ def __init__(self, steps: int): """Initializer. Args: steps: diffusion steps. """ self.steps = steps self.pe = 128 self.embeddings = 512 self.mappers = 2 self.channels = 64 ...
with open('.\\DARKCPU\\DARKCPU.bin', 'rb') as inputFile: with open('image.bin', 'wb') as outputFile: while True: bufA = inputFile.read(1) bufB = inputFile.read(1) if bufA == "" or bufB == "": break; outputFile.write(bufB) ...
with open('.\\DARKCPU\\DARKCPU.bin', 'rb') as input_file: with open('image.bin', 'wb') as output_file: while True: buf_a = inputFile.read(1) buf_b = inputFile.read(1) if bufA == '' or bufB == '': break outputFile.write(bufB) outputF...
class DefaultBindingPropertyAttribute: """ Specifies the default binding property for a component. This class cannot be inherited. DefaultBindingPropertyAttribute() DefaultBindingPropertyAttribute(name: str) """ def ZZZ(self): """hardcoded/mock instance of the class""" return DefaultBindingPrope...
class Defaultbindingpropertyattribute: """ Specifies the default binding property for a component. This class cannot be inherited. DefaultBindingPropertyAttribute() DefaultBindingPropertyAttribute(name: str) """ def zzz(self): """hardcoded/mock instance of the class""" return default_b...
# problem description can be added if required n = int(input()) hou = [int(i) for i in input().split()] p = int(input()) for i in range(p): a, b = [int(i) for i in input().split()] print(sum(hou[a - 1:b])) # sum was to be including both the 'a'th and 'b'th index
n = int(input()) hou = [int(i) for i in input().split()] p = int(input()) for i in range(p): (a, b) = [int(i) for i in input().split()] print(sum(hou[a - 1:b]))
class ModelAdmin: """ The class provides the possibility of declarative describe of information about the table and describe all things related to viewing this table on the administrator's page. class Users(models.ModelAdmin): class Meta: resource_type = PGResource ...
class Modeladmin: """ The class provides the possibility of declarative describe of information about the table and describe all things related to viewing this table on the administrator's page. class Users(models.ModelAdmin): class Meta: resource_type = PGResource ...
''' Base Class method Proxy''' #method 1, not recommand! class A: def spam(self, x): pass def foo(self): pass class B: def __init__(self): self._a = A() def spam(self, x): # Delegate to the internal self._a instance return self._a.spam(x) def foo(self): ...
""" Base Class method Proxy""" class A: def spam(self, x): pass def foo(self): pass class B: def __init__(self): self._a = a() def spam(self, x): return self._a.spam(x) def foo(self): return self._a.foo() def bar(self): pass class A: ...
class PacketSummary(object): """ A simple object containing a psml summary. Can contain various summary information about a packet. """ def __init__(self, structure, values): self._fields = {} self._field_order = [] for key, val in zip(structure, values): key, v...
class Packetsummary(object): """ A simple object containing a psml summary. Can contain various summary information about a packet. """ def __init__(self, structure, values): self._fields = {} self._field_order = [] for (key, val) in zip(structure, values): (key,...
# "Matrix Decomposition" # Alec Dewulf # April Cook Off 2020 # Difficulty: Simple # Concepts: Fast exponentiation, implementation """ This problem required the solver to caculate exponentials very quickly. I did that by computing everything mod so the numbers remained small. A more efficient exponent function could h...
""" This problem required the solver to caculate exponentials very quickly. I did that by computing everything mod so the numbers remained small. A more efficient exponent function could have also been used. """ t = int(input()) mod = 10 ** 9 + 7 for _ in range(T): (num_rows, value) = map(int, input().split()) ...
class Customer: def __init__(self, customer_id, first, last, email, address, city, state, zip_code, phone): self.id = customer_id self.first = first self.last = last self.email = email self.address = address self.city = city self.state = state self.zip...
class Customer: def __init__(self, customer_id, first, last, email, address, city, state, zip_code, phone): self.id = customer_id self.first = first self.last = last self.email = email self.address = address self.city = city self.state = state self.zi...
def solution(x): answer = True temp = 0 copy = x while copy != 0: r = copy % 10 copy //= 10 temp += r if x % temp != 0: answer = False return answer print(solution(13))
def solution(x): answer = True temp = 0 copy = x while copy != 0: r = copy % 10 copy //= 10 temp += r if x % temp != 0: answer = False return answer print(solution(13))
# ------------------------------ # 138. Copy List with Random Pointer # # Description: # A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. # Return a deep copy of the list. # # Version: 1.0 # 08/21/18 by Jianfa # -----------------------...
class Solution(object): def copy_random_list(self, head): """ :type head: RandomListNode :rtype: RandomListNode """ iterhead = head while iterhead: nextnode = iterhead.next copynode = random_list_node(iterhead.label) iterhead.next ...
#!/usr/bin/python # Tutaj _used i independent_set jest typu set. class UnorderedSequentialIndependentSet1: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" if graph.is_directed(): raise ValueError("the graph is directed") ...
class Unorderedsequentialindependentset1: """Find a maximal independent set.""" def __init__(self, graph): """The algorithm initialization.""" if graph.is_directed(): raise value_error('the graph is directed') self.graph = graph for edge in self.graph.iteredges(): ...
input = '''10 3 15 10 5 15 5 15 9 2 5 8 5 2 3 6''' memory = [int(x) for x in input.split('\t')] memory_status = [] def update_memoery(memory): highest_bank = max(memory) highest_index = memory.index(highest_bank) memory[highest_index] = 0 i = 0 while i < highest_bank: memory[(highest_inde...
input = '10\t3\t15\t10\t5\t15\t5\t15\t9\t2\t5\t8\t5\t2\t3\t6' memory = [int(x) for x in input.split('\t')] memory_status = [] def update_memoery(memory): highest_bank = max(memory) highest_index = memory.index(highest_bank) memory[highest_index] = 0 i = 0 while i < highest_bank: memory[(hig...
for _ in range(int(input())): n,x = [int(x) for x in input().split()] dp = {} s = input() dp[x] = 1 for i in s: if(i == "R"): x += 1 else:x -= 1 if(not dp.get(x)):dp[x] = 1 print(len(dp))
for _ in range(int(input())): (n, x) = [int(x) for x in input().split()] dp = {} s = input() dp[x] = 1 for i in s: if i == 'R': x += 1 else: x -= 1 if not dp.get(x): dp[x] = 1 print(len(dp))
class FontStyleConverter(TypeConverter): """ Converts instances of System.Windows.FontStyle to and from other data types. FontStyleConverter() """ def CanConvertFrom(self,*__args): """ CanConvertFrom(self: FontStyleConverter,td: ITypeDescriptorContext,t: Type) -> bool Returns a value that...
class Fontstyleconverter(TypeConverter): """ Converts instances of System.Windows.FontStyle to and from other data types. FontStyleConverter() """ def can_convert_from(self, *__args): """ CanConvertFrom(self: FontStyleConverter,td: ITypeDescriptorContext,t: Type) -> bool Returns a valu...
def median(array): array = sorted(array) if len(array) % 2 == 0: return (array[(len(array) - 1) // 2] + array[len(array) // 2]) / 2 else: return array[len(array) // 2]
def median(array): array = sorted(array) if len(array) % 2 == 0: return (array[(len(array) - 1) // 2] + array[len(array) // 2]) / 2 else: return array[len(array) // 2]
# Copyright 2019 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause class PrePostProcessor(object): def pre_process(self, data): type(self) return data def post_process(self, data): type(self) return data
class Prepostprocessor(object): def pre_process(self, data): type(self) return data def post_process(self, data): type(self) return data
def find_digits(digits1, digits2, digit_quantity_to_find): print('Inputs:') print('\tdigits1 = %s' % (digits1)) print('\tdigits2 = %s' % (digits2)) print('\tdigit_quantity_to_find = %d' % (digit_quantity_to_find)) digit_count_by_input = [len(digits1), len(digits2)] positions_by_digit_input = [...
def find_digits(digits1, digits2, digit_quantity_to_find): print('Inputs:') print('\tdigits1 = %s' % digits1) print('\tdigits2 = %s' % digits2) print('\tdigit_quantity_to_find = %d' % digit_quantity_to_find) digit_count_by_input = [len(digits1), len(digits2)] positions_by_digit_input = [[[], []]...
class Args: """ This module helps in preventing args being sent through multiple of classes to reach any analysis/laser module """ def __init__(self): self.solver_timeout = 10000 self.sparse_pruning = True self.unconstrained_storage = False args = Args()
class Args: """ This module helps in preventing args being sent through multiple of classes to reach any analysis/laser module """ def __init__(self): self.solver_timeout = 10000 self.sparse_pruning = True self.unconstrained_storage = False args = args()
# (c) 2012 Urban Airship and Contributors __version__ = (0, 2, 0) class RequestIPStorage(object): def __init__(self): self.ip = None def set(self, ip): self.ip = ip def get(self): return self.ip _request_ip_storage = RequestIPStorage() get_current_ip = _request_ip_storage.get s...
__version__ = (0, 2, 0) class Requestipstorage(object): def __init__(self): self.ip = None def set(self, ip): self.ip = ip def get(self): return self.ip _request_ip_storage = request_ip_storage() get_current_ip = _request_ip_storage.get set_current_ip = _request_ip_storage.set
def sum_of_squares(value): sum = 0 for _ in range(value + 1): sum = sum + _ ** 2 return sum def summed_squares(value): sum = 0 for _ in range(value + 1): sum += _ return sum ** 2 print(summed_squares(100) - sum_of_squares(100))
def sum_of_squares(value): sum = 0 for _ in range(value + 1): sum = sum + _ ** 2 return sum def summed_squares(value): sum = 0 for _ in range(value + 1): sum += _ return sum ** 2 print(summed_squares(100) - sum_of_squares(100))
# Part 1 data = data.split("\r\n\r\n") nums = list(map(int, data[0].split(","))) boards = [] for k in data[1:]: boards.append([]) for j in k.splitlines(): boards[-1].append(list(map(int, j.split()))) for num in nums: for board in boards: for row in board: for i in range(len(row...
data = data.split('\r\n\r\n') nums = list(map(int, data[0].split(','))) boards = [] for k in data[1:]: boards.append([]) for j in k.splitlines(): boards[-1].append(list(map(int, j.split()))) for num in nums: for board in boards: for row in board: for i in range(len(row)): ...
def test_000_a_test_can_pass(): print("This test should always pass!") assert True def test_001_can_see_the_internet(selenium): selenium.get('http://www.example.com')
def test_000_a_test_can_pass(): print('This test should always pass!') assert True def test_001_can_see_the_internet(selenium): selenium.get('http://www.example.com')
f = open("shaam.txt") # tell() tell the position of our f pointer # print(f.readline()) # print(f.tell()) # print(f.readline()) # print(f.tell()) # seek() point the pointer to given index f.seek(5) print(f.readline()) f.close()
f = open('shaam.txt') f.seek(5) print(f.readline()) f.close()
""" Stores all global variables """ global d, aSub1, aSubN, aSubX, aSubY, x, y, sSubN, n, operations, selection, r # declares all variables global r = None # common rate d = None # common difference aSub1 = None # first number in sequence aSubN = None # number in sequence given index n aSubX = None # nu...
""" Stores all global variables """ global d, aSub1, aSubN, aSubX, aSubY, x, y, sSubN, n, operations, selection, r r = None d = None a_sub1 = None a_sub_n = None a_sub_x = None a_sub_y = None x = None y = None s_sub_n = None n = None selection = None operations = ['arithmetic summation', 'arithmetic sequence', 'geometr...
dp=[[0]*5 for i in range(101)] dp[0][0]=1 dp[1][0]=1 dp[2][0]=1 dp[2][1]=1 dp[2][2]=1 dp[2][3]=1 dp[2][4]=1 for i in range(3,101): dp[i][0]=sum(dp[i-1]) dp[i][4]=sum(dp[i-2]) j=i-2 while j>=0: dp[i][1]+=sum(dp[j]) j-=2 j=i-2 while j>=0: dp[i][2]+=sum(dp[j]) dp[i][3]+=sum(dp[j]) j-=1 for...
dp = [[0] * 5 for i in range(101)] dp[0][0] = 1 dp[1][0] = 1 dp[2][0] = 1 dp[2][1] = 1 dp[2][2] = 1 dp[2][3] = 1 dp[2][4] = 1 for i in range(3, 101): dp[i][0] = sum(dp[i - 1]) dp[i][4] = sum(dp[i - 2]) j = i - 2 while j >= 0: dp[i][1] += sum(dp[j]) j -= 2 j = i - 2 while j >= 0: ...
# leapyear y=input("enter any year") if y%4==0: print("{} is:leap year".format(y)) else: print("{} is not a leap year".format(y))
y = input('enter any year') if y % 4 == 0: print('{} is:leap year'.format(y)) else: print('{} is not a leap year'.format(y))
t = int(input()) for i in range(t): n, m = list(map(int, input().split())) if(n%m == 0): print("YES") else: print("NO")
t = int(input()) for i in range(t): (n, m) = list(map(int, input().split())) if n % m == 0: print('YES') else: print('NO')
a, b, c = (int(input()) for i in range(3)) if a <= b <= c: print("True") else: print("False")
(a, b, c) = (int(input()) for i in range(3)) if a <= b <= c: print('True') else: print('False')
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # def f_gold ( arr , n , x ) : for i in range ( n ) : if arr [ i ] > arr [ i + 1 ] : break l = ( i + 1...
def f_gold(arr, n, x): for i in range(n): if arr[i] > arr[i + 1]: break l = (i + 1) % n r = i cnt = 0 while l != r: if arr[l] + arr[r] == x: cnt += 1 if l == (r - 1 + n) % n: return cnt l = (l + 1) % n r = (r...
class Queue: def __init__(self) -> None: self._queue = [] def insert(self, val: int) -> None: self._queue.append(val) def pop(self) -> None: self._queue.pop(0) def __str__(self): return "{}".format(self._queue) def __len__(self): ...
class Queue: def __init__(self) -> None: self._queue = [] def insert(self, val: int) -> None: self._queue.append(val) def pop(self) -> None: self._queue.pop(0) def __str__(self): return '{}'.format(self._queue) def __len__(self): return len(self._queue) i...
class DeployResult(object): def __init__(self, vm_name, vm_uuid, cloud_provider_resource_name, autoload, inbound_ports, deployed_app_attributes, deployed_app_address, public_ip, resource_group, extension_time_out, vm_details_data): """ :param str vm_name: The name o...
class Deployresult(object): def __init__(self, vm_name, vm_uuid, cloud_provider_resource_name, autoload, inbound_ports, deployed_app_attributes, deployed_app_address, public_ip, resource_group, extension_time_out, vm_details_data): """ :param str vm_name: The name of the virtual machine :pa...
""" readtransaction.py Description: This class keeps track of keys for which a write operation is still pending when a client wants to perform a read operation. It also contains helper functions to easily store (pending) writes and return the values corresponding to those keys once no more keys...
""" readtransaction.py Description: This class keeps track of keys for which a write operation is still pending when a client wants to perform a read operation. It also contains helper functions to easily store (pending) writes and return the values corresponding to those keys once no more keys...
class PreRequisites: def __init__(self, course_list=None): self.course_list = course_list
class Prerequisites: def __init__(self, course_list=None): self.course_list = course_list
#!/usr/local/bin/python3 def soma_1(x, y): return x + y def soma_2(x, y, z): return x + y + z def soma(*numeros): return sum(numeros) if __name__ == '__main__': print(soma_1(10, 10)) print(soma_2(10, 10, 10)) # packing print(soma(10, 10, 10, 10)) # unpacking list_nums = [10, ...
def soma_1(x, y): return x + y def soma_2(x, y, z): return x + y + z def soma(*numeros): return sum(numeros) if __name__ == '__main__': print(soma_1(10, 10)) print(soma_2(10, 10, 10)) print(soma(10, 10, 10, 10)) list_nums = [10, 20] print(soma_1(*list_nums)) tuple_nums = (10, 20) ...
class ElementMulticlassFilter(ElementQuickFilter, IDisposable): """ A filter used to match elements by their class,where more than one class of element may be passed. ElementMulticlassFilter(typeList: IList[Type],inverted: bool) ElementMulticlassFilter(typeList: IList[Type]) """ def Dispose...
class Elementmulticlassfilter(ElementQuickFilter, IDisposable): """ A filter used to match elements by their class,where more than one class of element may be passed. ElementMulticlassFilter(typeList: IList[Type],inverted: bool) ElementMulticlassFilter(typeList: IList[Type]) """ def dispose(self): ...
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ m = {} for i, n in enumerate(nums): if (target-n) in m: return [m[target-n], i] m[n] = i
class Solution(object): def two_sum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ m = {} for (i, n) in enumerate(nums): if target - n in m: return [m[target - n], i] m[n] = i
class CPU: VECTOR_RESET = 0xFFFC # Reset Vector address. def __init__(self, system): self._system = system self._debug_log = open("debug.log", "w") def reset(self): # Program Counter 16-bit, default to value located at the reset vector address. self._pc = self._syste...
class Cpu: vector_reset = 65532 def __init__(self, system): self._system = system self._debug_log = open('debug.log', 'w') def reset(self): self._pc = self._system.mmu.read_word(self.VECTOR_RESET) self._sp = 253 self._a = 0 self._x = 0 self._y = 0 ...
# -*- coding: utf-8 -*- """ Created on Sat May 29 04:22:02 2021 @author: Septhiono """ print("Welcome to the Love Calculator!") name1 = input("What is your name? \n").lower() name2 = input("What is their name? \n").lower() name3=name1+name2 true=name3.count('t')+name3.count('r')+name3.count('u')+name3.coun...
""" Created on Sat May 29 04:22:02 2021 @author: Septhiono """ print('Welcome to the Love Calculator!') name1 = input('What is your name? \n').lower() name2 = input('What is their name? \n').lower() name3 = name1 + name2 true = name3.count('t') + name3.count('r') + name3.count('u') + name3.count('e') love = name3.coun...
def greet_customer(grocery_store, special_item): print("Welcome to "+ grocery_store + ".") print("Our special is " + special_item + ".") print("Have fun shopping!") greet_customer("Stu's Staples", "papayas") def mult_x_add_y(number, x, y): print("Total: ", number * x + y) mult_x_add_y(5, 2, 3) mult_x_add_y...
def greet_customer(grocery_store, special_item): print('Welcome to ' + grocery_store + '.') print('Our special is ' + special_item + '.') print('Have fun shopping!') greet_customer("Stu's Staples", 'papayas') def mult_x_add_y(number, x, y): print('Total: ', number * x + y) mult_x_add_y(5, 2, 3) mult_x_...
class TransitionId(object): ClearReadout=0 Reset =1 Configure =2 Unconfigure =3 BeginRun =4 EndRun =5 BeginStep =6 EndStep =7 Enable =8 Disable =9 SlowUpdate =10 Unused_11 =11 L1Accept =12 NumberOf =13
class Transitionid(object): clear_readout = 0 reset = 1 configure = 2 unconfigure = 3 begin_run = 4 end_run = 5 begin_step = 6 end_step = 7 enable = 8 disable = 9 slow_update = 10 unused_11 = 11 l1_accept = 12 number_of = 13
MIN_MATCH = 4 STRING = 0x0 BYTE_ARR = 0x01 NUMERIC_INT = 0x02 NUMERIC_FLOAT = 0x03 NUMERIC_LONG = 0x04 NUMERIC_DOUBLE = 0x05 SECOND = 1000 HOUR = 60 * 60 * SECOND DAY = 24 * HOUR SECOND_ENCODING = 0x40 HOUR_ENCODING = 0x80 DAY_ENCODING = 0xC0 BLOCK_SIZE = 128 INDEX_OPTION_NONE = 0 INDEX_OPTION_DOCS = 1 INDEX_OPTION_...
min_match = 4 string = 0 byte_arr = 1 numeric_int = 2 numeric_float = 3 numeric_long = 4 numeric_double = 5 second = 1000 hour = 60 * 60 * SECOND day = 24 * HOUR second_encoding = 64 hour_encoding = 128 day_encoding = 192 block_size = 128 index_option_none = 0 index_option_docs = 1 index_option_docs_freqs = 2 index_opt...
""" Hao Ren 11 October, 2020 344. Reverse String Python: One line solution. Just a joke. """ class Solution(object): def reverseString(self, s): """ :type s: List[str] :rtype: None Do not return anything, modify s in-place instead. """ s.reverse()
""" Hao Ren 11 October, 2020 344. Reverse String Python: One line solution. Just a joke. """ class Solution(object): def reverse_string(self, s): """ :type s: List[str] :rtype: None Do not return anything, modify s in-place instead. """ s.reverse()
#encoding:utf-8 subreddit = 'ProsePorn' t_channel = '@r_proseporn' def send_post(submission, r2t): return r2t.send_simple(submission)
subreddit = 'ProsePorn' t_channel = '@r_proseporn' def send_post(submission, r2t): return r2t.send_simple(submission)
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-2021 Dan <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free...
layer = 123 objects = {85337187: 'pyrogram.raw.types.ResPQ', 2211011308: 'pyrogram.raw.types.PQInnerData', 2851430293: 'pyrogram.raw.types.PQInnerDataDc', 1013613780: 'pyrogram.raw.types.PQInnerDataTemp', 1459478408: 'pyrogram.raw.types.PQInnerDataTempDc', 1973679973: 'pyrogram.raw.types.BindAuthKeyInner', 2043348061: ...
""" Given a sequence of elements a_1, a_2, ... , a_n, you would like to check whether it contains an element (majority element) that appears more than n/2 times. """ def find_majority_element(values): """ Returns the majority element or None if no such element found """ def find_candidate(): ...
""" Given a sequence of elements a_1, a_2, ... , a_n, you would like to check whether it contains an element (majority element) that appears more than n/2 times. """ def find_majority_element(values): """ Returns the majority element or None if no such element found """ def find_candidate(): ...
class MultiTable(object): """ Multiplication table for a given multiplicand """ def __init__(self, multiplicand): """ :param multiplicand: Initial value (int) """ if not isinstance(multiplicand, (int, float)): raise TypeError('Expected type(s): num <int, floa...
class Multitable(object): """ Multiplication table for a given multiplicand """ def __init__(self, multiplicand): """ :param multiplicand: Initial value (int) """ if not isinstance(multiplicand, (int, float)): raise type_error('Expected type(s): num <int, flo...
hour_exam = int(input()) min_exam = int(input()) hour_arrival = int(input()) min_arrival = int(input()) status = 0 exam_time = (hour_exam * 60) + min_exam arrival_time = (hour_arrival * 60) + min_arrival difference = arrival_time - exam_time if difference > 0: status = "Late" elif difference < -30: status =...
hour_exam = int(input()) min_exam = int(input()) hour_arrival = int(input()) min_arrival = int(input()) status = 0 exam_time = hour_exam * 60 + min_exam arrival_time = hour_arrival * 60 + min_arrival difference = arrival_time - exam_time if difference > 0: status = 'Late' elif difference < -30: status = 'Early'...
def foo(): ''' >>> from mod import good as bad ''' pass
def foo(): """ >>> from mod import good as bad """ pass
# # PySNMP MIB module CISCO-ETHERNET-FABRIC-EXTENDER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ETHERNET-FABRIC-EXTENDER-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:57:40 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint) ...
JAZZMIN_SETTINGS = { # title of the window 'site_title': 'DIT Admin', # Title on the brand, and the login screen (19 chars max) 'site_header': 'DIT', # square logo to use for your site, must be present in static files, used for favicon and brand on top left 'site_logo': 'data_log_sheet/img/log...
jazzmin_settings = {'site_title': 'DIT Admin', 'site_header': 'DIT', 'site_logo': 'data_log_sheet/img/logo.png', 'welcome_sign': 'Welcome to DIT Data Log Sheet', 'copyright': 'antonnifo', 'search_model': 'data_log_sheet.DataLogSheet', 'user_avatar': None, 'topmenu_links': [{'name': 'Home', 'url': 'admin:index', 'permis...
numbers = [4, 400, 5000] print("Max Value Element: ", max(numbers)) animals = ["dogs", "crocodiles", "turtles"] print(max(animals)) animals.append(["zebras"]) #adds the the list with one element "zebras" to the existing list as one object. print(animals) animals.extend("zebras") #iterates through the string one...
numbers = [4, 400, 5000] print('Max Value Element: ', max(numbers)) animals = ['dogs', 'crocodiles', 'turtles'] print(max(animals)) animals.append(['zebras']) print(animals) animals.extend('zebras') print(animals) animals.append(['zebras, lions, tigers']) print(animals) animals.extend(['zebras, lions, tigers']) print(a...
def get_subarray_sum_1(s_array): #O(n**2) ''' Return max subarray and max subarray sum ''' #initialise variables max_sum = 0 max_sub_array = [] #get all items in array and go through them for item in range(len(s_array)): #get all possible sub arrays while maintaining their max...
def get_subarray_sum_1(s_array): """ Return max subarray and max subarray sum """ max_sum = 0 max_sub_array = [] for item in range(len(s_array)): index1 = item index2 = item while index2 < len(s_array): index2 += 1 if sum(s_array[index1:index2 + 1]...
#sort function def Binary_Insertion_Sort(lst): for i in range(1, len(lst)): x = lst[i] # here x is a temporary variable pos = BinarySearch(lst, x, 0, i) + 1 for j in range(i, pos, -1): lst[j] = lst[j - 1] lst[pos] = x #binary search func...
def binary__insertion__sort(lst): for i in range(1, len(lst)): x = lst[i] pos = binary_search(lst, x, 0, i) + 1 for j in range(i, pos, -1): lst[j] = lst[j - 1] lst[pos] = x def binary_search(array, value, low, high): if high - low <= 1: if value < array[low]:...
"""Code sample.""" def myfunc(s): """Convert strings to mixed caps.""" ret_val = '' index = 0 for letter in s: if index % 2 == 0: ret_val = ret_val + letter.upper() else: ret_val = ret_val + letter.lower() index = index+1 return ret_val
"""Code sample.""" def myfunc(s): """Convert strings to mixed caps.""" ret_val = '' index = 0 for letter in s: if index % 2 == 0: ret_val = ret_val + letter.upper() else: ret_val = ret_val + letter.lower() index = index + 1 return ret_val
prog = ['H', 'Q', '9'] code = list(i for i in input()) run = False for i in code: if i in prog: run = True break if run: print('YES') else: print('NO')
prog = ['H', 'Q', '9'] code = list((i for i in input())) run = False for i in code: if i in prog: run = True break if run: print('YES') else: print('NO')
def th_selector(over_area, altitude): if altitude <= 10: th_x = over_area // 2 # 40 th_y = over_area // 4 # 20 return th_x, th_y elif altitude <=20: th_x = over_area // 8 th_y = over_area // 20 return th_x, th_y else: th_x = over_area // 20 th_...
def th_selector(over_area, altitude): if altitude <= 10: th_x = over_area // 2 th_y = over_area // 4 return (th_x, th_y) elif altitude <= 20: th_x = over_area // 8 th_y = over_area // 20 return (th_x, th_y) else: th_x = over_area // 20 th_y = o...
MAX_SIZE = 2000001 isprime = [True] * MAX_SIZE prime = [] SPF = [None] * (MAX_SIZE) def sieve(N): isprime[0] = isprime[1] = False for i in range(2, N): if isprime[i] == True: prime.append(i) SPF[i] = i j = 0 while j < len(prime) and i * prime[j] < N and prime[j]...
max_size = 2000001 isprime = [True] * MAX_SIZE prime = [] spf = [None] * MAX_SIZE def sieve(N): isprime[0] = isprime[1] = False for i in range(2, N): if isprime[i] == True: prime.append(i) SPF[i] = i j = 0 while j < len(prime) and i * prime[j] < N and (prime[j] <...
# # 01 solution line_nums = input().split() remove = int(input()) line_nums_list = [int(x) for x in line_nums] for i in range(remove): line_nums_list.remove(min(line_nums_list)) line_nums = ", ".join([str(x) for x in line_nums_list]) print(line_nums) # # INPUT 1 # 10 9 8 7 6 5 # 3 # # INPUT 2 # 1 10 2 9 3 8 # 2 # #...
line_nums = input().split() remove = int(input()) line_nums_list = [int(x) for x in line_nums] for i in range(remove): line_nums_list.remove(min(line_nums_list)) line_nums = ', '.join([str(x) for x in line_nums_list]) print(line_nums)
def Owl(thoughts, eyes, eye, tongue): return f""" {thoughts} {thoughts} ___ (o o) ( V ) /--m-m- """
def owl(thoughts, eyes, eye, tongue): return f'\n {thoughts}\n {thoughts}\n ___\n (o o)\n ( V )\n /--m-m-\n'
""" https://leetcode.com/problems/length-of-last-word/ Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word (last word means the last appearing word if we loop from left to right) in the string. If the last word does not exist, return 0. Note: A word i...
""" https://leetcode.com/problems/length-of-last-word/ Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word (last word means the last appearing word if we loop from left to right) in the string. If the last word does not exist, return 0. Note: A word i...
""" Using while loop for the first time. """ #Declaring variables x = 0 #initiating the loop while x >= 10: #Stuff that gets iterated when the condition above is true print("Dard to hai") x = x + 2 #The loop has finally ended print("The loop has finally ended")
""" Using while loop for the first time. """ x = 0 while x >= 10: print('Dard to hai') x = x + 2 print('The loop has finally ended')
''' Routines for generating dynamic files. ''' def file_with_dyn_area( file_path, content, first_guard='<!-- guard line: beginning -->', second_guard='<!-- guard line: end -->'): ''' The function reads a file, locates the guards, replaces the content. ''' full_content = '' g...
""" Routines for generating dynamic files. """ def file_with_dyn_area(file_path, content, first_guard='<!-- guard line: beginning -->', second_guard='<!-- guard line: end -->'): """ The function reads a file, locates the guards, replaces the content. """ full_content = '' guard_count = 0 with o...
# @arnaud drop this file? # ---------------------------------------------------------------------- # # Misc constants # UA_MAXOP = 6 # ---------------------------------------------------------------------- # instruc_t related constants # # instruc_t.feature # CF_STOP = 0x00001 # Instruction doesn't pass execution...
ua_maxop = 6 cf_stop = 1 cf_call = 2 cf_chg1 = 4 cf_chg2 = 8 cf_chg3 = 16 cf_chg4 = 32 cf_chg5 = 64 cf_chg6 = 128 cf_use1 = 256 cf_use2 = 512 cf_use3 = 1024 cf_use4 = 2048 cf_use5 = 4096 cf_use6 = 8192 cf_jump = 16384 cf_shft = 32768 cf_hll = 65536 o_void = 0 o_reg = 1 o_mem = 2 o_phrase = 3 o_displ = 4 o_imm = 5 o_far...
input = """ n(x4000). n(x3999). n(x3998). n(x3997). n(x3996). n(x3995). n(x3994). n(x3993). n(x3992). n(x3991). n(x3990). n(x3989). n(x3988). n(x3987). n(x3986). n(x3985). n(x3984). n(x3983). n(x3982). n(x3981). n(x3980). n(x3979). n(x3978). n(x3977). n(x3976). n(x3975). n(x3974). n(x3973). ...
input = '\nn(x4000).\nn(x3999).\nn(x3998).\nn(x3997).\nn(x3996).\nn(x3995).\nn(x3994).\nn(x3993).\nn(x3992).\nn(x3991).\nn(x3990).\nn(x3989).\nn(x3988).\nn(x3987).\nn(x3986).\nn(x3985).\nn(x3984).\nn(x3983).\nn(x3982).\nn(x3981).\nn(x3980).\nn(x3979).\nn(x3978).\nn(x3977).\nn(x3976).\nn(x3975).\nn(x3974).\nn(x3973).\nn...
n = int(input()) if n == 1: print(101) exit() a = sum(map(int, input().split())) ans = 0 for i in range(101): if (a + i) % n == 0: ans += 1 print(ans)
n = int(input()) if n == 1: print(101) exit() a = sum(map(int, input().split())) ans = 0 for i in range(101): if (a + i) % n == 0: ans += 1 print(ans)
class QuerioFileError(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, args, kwargs)
class Queriofileerror(Exception): def __init__(self, *args, **kwargs): Exception.__init__(self, args, kwargs)
def countWords(file): wordsCount = 0 with open(file, "r") as f: for line in f: words = line.split() wordsCount += len(words) print (wordsCount)
def count_words(file): words_count = 0 with open(file, 'r') as f: for line in f: words = line.split() words_count += len(words) print(wordsCount)
class SqlInsertError(Exception): def __init__(self, object, table: str) -> None: self.object = object self.table = table super().__init__(f'Could not insert {object.__repr__()} in {table}.') class SqlSelectError(Exception): def __init__(self, table: str, function: str, data=None) -> No...
class Sqlinserterror(Exception): def __init__(self, object, table: str) -> None: self.object = object self.table = table super().__init__(f'Could not insert {object.__repr__()} in {table}.') class Sqlselecterror(Exception): def __init__(self, table: str, function: str, data=None) -> N...
# -*- coding: utf-8 -*- MONGO_CONFIG = { 'host': '47.93.9.48', 'port': 27017, 'user': 'root', 'pwd': 'Yunxi20191231' } chrome_driver_path = '/usr/local/bin/chromedriver' sogou_wechat_url = 'https://weixin.sogou.com'
mongo_config = {'host': '47.93.9.48', 'port': 27017, 'user': 'root', 'pwd': 'Yunxi20191231'} chrome_driver_path = '/usr/local/bin/chromedriver' sogou_wechat_url = 'https://weixin.sogou.com'
# coding: utf-8 # Distributed under the terms of the MIT License. class AppModel(object): def __init__(self): pass def __run__(self): pass
class Appmodel(object): def __init__(self): pass def __run__(self): pass
def find_first_invalid(numbers): for k in range(25, len(numbers)): if not any( numbers[i] + numbers[j] == numbers[k] for i in range(k - 25, k) for j in range(i + 1, k) ): return numbers[k] with open("input.txt", 'r', encoding="utf-8") as file: in...
def find_first_invalid(numbers): for k in range(25, len(numbers)): if not any((numbers[i] + numbers[j] == numbers[k] for i in range(k - 25, k) for j in range(i + 1, k))): return numbers[k] with open('input.txt', 'r', encoding='utf-8') as file: inp = list(map(int, file)) print(find_first_inva...
""" You are given the root node of a binary search tree (BST). You need to write a function that returns the sum of values of all the nodes with a value between lower and upper (inclusive). The BST is guaranteed to have unique values. """ # Binary trees are already defined with this interface: # class Tree(object)...
""" You are given the root node of a binary search tree (BST). You need to write a function that returns the sum of values of all the nodes with a value between lower and upper (inclusive). The BST is guaranteed to have unique values. """ def cs_bst_range_sum(root, lower, upper): res = 0 stack = [root] ...
class Solution: def addStrings(self, num1: str, num2: str) -> str: res = '' add_on = 0 i, j = len(num1) - 1, len(num2) - 1 while i != -1 or j != -1: if i != -1 and j != -1: digit_sum = int(num1[i]) + int(num2[j]) + add_on i -= 1 ...
class Solution: def add_strings(self, num1: str, num2: str) -> str: res = '' add_on = 0 (i, j) = (len(num1) - 1, len(num2) - 1) while i != -1 or j != -1: if i != -1 and j != -1: digit_sum = int(num1[i]) + int(num2[j]) + add_on i -= 1 ...
def sort_by_key(my_list=[], keys=[]): """ Reorder your list ASC/DESC based on multiple keys Parameters: :param (list) my_list: list of objects you want to order [{'code': 'beta', 'number': 3}, {'code': 'delta', 'number': 2}] :param (list) keys: list of dict keys and direction t...
def sort_by_key(my_list=[], keys=[]): """ Reorder your list ASC/DESC based on multiple keys Parameters: :param (list) my_list: list of objects you want to order [{'code': 'beta', 'number': 3}, {'code': 'delta', 'number': 2}] :param (list) keys: list of dict keys and direction t...
# -*- mode: python; -*- # Copyright 2011 Google Inc. All Rights Reserved. # # 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 require...
"""Utility rules for building extension bundles. Before you use any functions from this file, include the following line in your BUILD file. subinclude('//testing/chronos/bite/builddefs:BUILD.bundle') Usage example: MIMIC_SRC = '//experimental/users/jasonstredwick/mimic/mimic' BUNDLE_ENTRIES = [ # M...
class Matrix(object): def __init__(self, matrix_string): self.matrix = [] rows = matrix_string.splitlines() for row in rows: self.matrix.append([int(num) for num in row.split()]) def row(self, index): return self.matrix[index - 1] def column(self, index): ...
class Matrix(object): def __init__(self, matrix_string): self.matrix = [] rows = matrix_string.splitlines() for row in rows: self.matrix.append([int(num) for num in row.split()]) def row(self, index): return self.matrix[index - 1] def column(self, index): ...
# coding ~utf-8 """ Author: Louai KB Binary tree classes to implement the Huffman Binary Tree for the compression process. """ class TreeNode: """This class implements the nodes of the tree""" def __init__(self, data : any, character:str=None) -> None: """Constructor of our TreeNode class ...
""" Author: Louai KB Binary tree classes to implement the Huffman Binary Tree for the compression process. """ class Treenode: """This class implements the nodes of the tree""" def __init__(self, data: any, character: str=None) -> None: """Constructor of our TreeNode class Args: ...
def mesclaListas(lista1, lista2): lista1.sort() lista2.sort() listaMesclada = [] i = 0 for i in lista2: if lista1[0] < i: listaMesclada.append(lista1.pop(0)) for i in lista1: if lista2[0] < i: listaMesclada.append(lista2.pop(0)) print(lista1, lista2)...
def mescla_listas(lista1, lista2): lista1.sort() lista2.sort() lista_mesclada = [] i = 0 for i in lista2: if lista1[0] < i: listaMesclada.append(lista1.pop(0)) for i in lista1: if lista2[0] < i: listaMesclada.append(lista2.pop(0)) print(lista1, lista2)...
def multBy3(x): return x*3 def add5(y): return y+5 def applyfunc(f, g, p): return f(p), g(p) print(applyfunc(multBy3, add5, 3)) def returnArgsAsList(das, *lis): print(lis) print(das) returnArgsAsList(2, 1,2,3,5,6,'byn')
def mult_by3(x): return x * 3 def add5(y): return y + 5 def applyfunc(f, g, p): return (f(p), g(p)) print(applyfunc(multBy3, add5, 3)) def return_args_as_list(das, *lis): print(lis) print(das) return_args_as_list(2, 1, 2, 3, 5, 6, 'byn')
class Field: def __init__(self, name, encoder, decoder): assert name and isinstance(name, str) assert encoder and callable(encoder) assert decoder and callable(decoder) self.name = name self.encoder = encoder self.decoder = decoder
class Field: def __init__(self, name, encoder, decoder): assert name and isinstance(name, str) assert encoder and callable(encoder) assert decoder and callable(decoder) self.name = name self.encoder = encoder self.decoder = decoder
class StickSymbolLocation(Enum, IComparable, IFormattable, IConvertible): """ Indicates the stick symbol location on the UI,which is used for the BuiltInParameter STRUCTURAL_STICK_SYMBOL_LOCATION. enum StickSymbolLocation,values: StickViewBottom (2),StickViewCenter (0),StickViewLocLine (3),StickViewTop ...
class Sticksymbollocation(Enum, IComparable, IFormattable, IConvertible): """ Indicates the stick symbol location on the UI,which is used for the BuiltInParameter STRUCTURAL_STICK_SYMBOL_LOCATION. enum StickSymbolLocation,values: StickViewBottom (2),StickViewCenter (0),StickViewLocLine (3),StickViewTop (1) "...
def valid(triangle): big = max(triangle) return big < sum(triangle) - big def part1(triangles): return sum(map(valid, triangles)) def group(n, it): return zip(*[iter(it)]*n) def transpose(it): return zip(*it) def part2(triangles): triangles = group(3, triangles) triangles = (t for gr...
def valid(triangle): big = max(triangle) return big < sum(triangle) - big def part1(triangles): return sum(map(valid, triangles)) def group(n, it): return zip(*[iter(it)] * n) def transpose(it): return zip(*it) def part2(triangles): triangles = group(3, triangles) triangles = (t for grou...