content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Constructor with arguments or parameters default class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def distance(self, point2): "Calculates distance between current point to given point2" x = point2.x - self.x y = point2.y - self.y d = x**2 ...
class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def distance(self, point2): """Calculates distance between current point to given point2""" x = point2.x - self.x y = point2.y - self.y d = x ** 2 + y ** 2 return d ** 0.5 p2 = point(3, 4) ...
def encode(content: bytes): p = list(content) oa = ord('a') oz = ord('z') oA = ord('A') oZ = ord('Z') for i in range(len(p)): if oa <= p[i] <= oz: p[i] = oa + 25 - p[i] + oa elif oA <= p[i] <= oZ: p[i] = oA + 25 - p[i] + oA return bytes(p) def decode...
def encode(content: bytes): p = list(content) oa = ord('a') oz = ord('z') o_a = ord('A') o_z = ord('Z') for i in range(len(p)): if oa <= p[i] <= oz: p[i] = oa + 25 - p[i] + oa elif oA <= p[i] <= oZ: p[i] = oA + 25 - p[i] + oA return bytes(p) def decod...
# Write a function def equals(a, b) that checks whether two lists have the same # elements in the same order. # FUNCTIONS def equals(listA, listB): if len(listA) < len(listB) or len(listA) > len(listB): return False equalBool = False for i in range(len(listA)): if listA[i] == listB[i]: ...
def equals(listA, listB): if len(listA) < len(listB) or len(listA) > len(listB): return False equal_bool = False for i in range(len(listA)): if listA[i] == listB[i]: equal_bool = True else: return False return equalBool def main(): example_list_a = [1...
def old_test(): core = Core(User='',Password='',ip='192.168.61.2') core.start() #gain = Control(parent=core,Name='gain',ValueType=int) cg = ChangeGroup(parent=core,Id='mygroup') #create some control objects for i in range(1,10): l = Control(parent=core,Name='Mixer6x9Output{}Label'...
def old_test(): core = core(User='', Password='', ip='192.168.61.2') core.start() cg = change_group(parent=core, Id='mygroup') for i in range(1, 10): l = control(parent=core, Name='Mixer6x9Output{}Label'.format(i), ValueType=str) cg.AddControl(l) m = control(parent=core, Name='Mi...
NODE_STATS_UPDATE_INTERVAL_SECONDS = 1 UPDATE_NODES_INTERVAL_SECONDS = 5 MAX_COUNT_OF_GCS_RPC_ERROR = 10 MAX_LOGS_TO_CACHE = 10000 LOG_PRUNE_THREASHOLD = 1.25
node_stats_update_interval_seconds = 1 update_nodes_interval_seconds = 5 max_count_of_gcs_rpc_error = 10 max_logs_to_cache = 10000 log_prune_threashold = 1.25
class Solution(object): def minTaps(self, n, ranges): """ :type n: int :type ranges: List[int] :rtype: int """ ranges = [(i-r,i+r) for i,r in enumerate(ranges)] ranges.sort(reverse = True) watered = 0 ans = 0 while ra...
class Solution(object): def min_taps(self, n, ranges): """ :type n: int :type ranges: List[int] :rtype: int """ ranges = [(i - r, i + r) for (i, r) in enumerate(ranges)] ranges.sort(reverse=True) watered = 0 ans = 0 while ranges: ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"kcred": "extract.ipynb", "unzip": "extract.ipynb", "download_kaggle_dataset": "extract.ipynb"} modules = ["loader.py"] doc_url = "https://talosiot-will.github.io/agora/" git_url = "https...
__all__ = ['index', 'modules', 'custom_doc_links', 'git_url'] index = {'kcred': 'extract.ipynb', 'unzip': 'extract.ipynb', 'download_kaggle_dataset': 'extract.ipynb'} modules = ['loader.py'] doc_url = 'https://talosiot-will.github.io/agora/' git_url = 'https://github.com/talosiot-will/agora/tree/master/' def custom_do...
def generate_python(fields): pkgSize = 0 pkgStr = '<' for field in fields: pkgSize += field.fieldType.length pkgStr += field.fieldType.charCode pyStr = 'PACKAGE_LEN = '+str(pkgSize)+'\n' pyStr += 'PACKAGE_CODE = "'+pkgStr+'"\n' pyStr += 'PACKAGE_FIELDS = ' + list( m...
def generate_python(fields): pkg_size = 0 pkg_str = '<' for field in fields: pkg_size += field.fieldType.length pkg_str += field.fieldType.charCode py_str = 'PACKAGE_LEN = ' + str(pkgSize) + '\n' py_str += 'PACKAGE_CODE = "' + pkgStr + '"\n' py_str += 'PACKAGE_FIELDS = ' + list(m...
PLATFORM_COMPILER_FLAGS = [ '-std=c++14', '-Wall', '-Wextra', # For TestCommon.h '-Wno-pragmas', ]
platform_compiler_flags = ['-std=c++14', '-Wall', '-Wextra', '-Wno-pragmas']
x = 0 score = x # Question One print("What are the plants and trees release into the air?") answer_1 = input("a)air\nb)oxygen\nc)music\nd)zak's fart \n:") if answer_1.lower() == "b" or answer_1.lower() == "oxygen": print("Correct") x = x + 1 else: print("Incorrect, it's oxygen") # Question Two print("...
x = 0 score = x print('What are the plants and trees release into the air?') answer_1 = input("a)air\nb)oxygen\nc)music\nd)zak's fart \n:") if answer_1.lower() == 'b' or answer_1.lower() == 'oxygen': print('Correct') x = x + 1 else: print("Incorrect, it's oxygen") print('What color is the trash can you put ...
class BaseMarkupEngine(object): def __init__(self, message, obj=None): self.message = message self.obj = obj class BaseQuoteEngine(object): def __init__(self, post, username): self.post = post self.username = username
class Basemarkupengine(object): def __init__(self, message, obj=None): self.message = message self.obj = obj class Basequoteengine(object): def __init__(self, post, username): self.post = post self.username = username
''' Interpret text as though all letters are off by one key location Status: Accepted ''' ############################################################################### def main(): """Read input and print output""" lut, keys = {' ': ' '}, [] keys.append('`1234567890-=') keys.append('QWERTYUIOP[]\\'...
""" Interpret text as though all letters are off by one key location Status: Accepted """ def main(): """Read input and print output""" (lut, keys) = ({' ': ' '}, []) keys.append('`1234567890-=') keys.append('QWERTYUIOP[]\\') keys.append("ASDFGHJKL;'") keys.append('ZXCVBNM,./') for row in ...
__author__ = "Cauani Castro" __copyright__ = "Copyright 2015, Cauani Castro" __credits__ = ["Cauani Castro"] __license__ = "Apache License 2.0" __version__ = "1.0" __maintainer__ = "Cauani Castro" __email__ = "cauani.castro@hotmail.com" __status__ = "Examination program" #funcao recursiva que acumula o resultado em va...
__author__ = 'Cauani Castro' __copyright__ = 'Copyright 2015, Cauani Castro' __credits__ = ['Cauani Castro'] __license__ = 'Apache License 2.0' __version__ = '1.0' __maintainer__ = 'Cauani Castro' __email__ = 'cauani.castro@hotmail.com' __status__ = 'Examination program' def base3_para10(b3, exp, b10): if b3 % 10 ...
people_waiting = int(input()) wagon_state = input().split() len_ = len(wagon_state) counter = 0 is_full = False if people_waiting == 0: print(*wagon_state) exit(0) for el in range(len_): counter = int(wagon_state[el]) if counter == 4: is_full = True continue for people in range(4): ...
people_waiting = int(input()) wagon_state = input().split() len_ = len(wagon_state) counter = 0 is_full = False if people_waiting == 0: print(*wagon_state) exit(0) for el in range(len_): counter = int(wagon_state[el]) if counter == 4: is_full = True continue for people in range(4): ...
name, age = "Shelby De Oliveira", 29 username = "shelb-doc" print ('Hello!') print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
(name, age) = ('Shelby De Oliveira', 29) username = 'shelb-doc' print('Hello!') print('Name: {}\nAge: {}\nUsername: {}'.format(name, age, username))
#!/usr/bin/env python # -*- coding: utf8 -*- # coding: utf8 class Room(): def __init__(self, serv, room_name, admin_username, bot_username, lutra_username, website_url, user_list): # Class attributes self.serv = serv self.room_name = room_name self.admin_username = admin_username ...
class Room: def __init__(self, serv, room_name, admin_username, bot_username, lutra_username, website_url, user_list): self.serv = serv self.room_name = room_name self.admin_username = admin_username self.bot_username = bot_username self.lutra_username = lutra_username ...
""" Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Given an array of numbers arr and a window of size k, print out the median of each window of size k starting from the left and moving right by one position each time. For example, given the following array and k = ...
""" Good morning! Here's your coding interview problem for today. This problem was asked by Microsoft. Given an array of numbers arr and a window of size k, print out the median of each window of size k starting from the left and moving right by one position each time. For example, given the following array and k = ...
class Solution: def productExceptSelf(self, nums: list[int]) -> list[int]: result = [1] * len(nums) prefix = 1 for i in range(len(nums)): result[i] *= prefix prefix *= nums[i] postfix = 1 for i in range(len(nums) - 1, -1, -1): result[i] *= ...
class Solution: def product_except_self(self, nums: list[int]) -> list[int]: result = [1] * len(nums) prefix = 1 for i in range(len(nums)): result[i] *= prefix prefix *= nums[i] postfix = 1 for i in range(len(nums) - 1, -1, -1): result[i] ...
''' from os.path import expanduser, exists, split if __name__ == '__main__': print('[TPL] Test Extern Features') import multiprocessing multiprocessing.freeze_support() def ensure_hotspotter(): import matplotlib matplotlib.use('Qt4Agg', warn=True, force=True) # Look for hotspott...
""" from os.path import expanduser, exists, split if __name__ == '__main__': print('[TPL] Test Extern Features') import multiprocessing multiprocessing.freeze_support() def ensure_hotspotter(): import matplotlib matplotlib.use('Qt4Agg', warn=True, force=True) # Look for hotspott...
MONGO_URI = 'mongodb://steemit:steemit@mongo1.steemdata.com:27017/SteemData' MONGO_DBNAME = 'SteemData' # 50 items per page by default PAGINATION_DEFAULT = 50 # allow 1000 requests per minute RATE_LIMIT_GET = (1000, 60) # change status message STATUS_ERR = 'ERROR' # change default response fields EXTRA_RESPONSE_FIE...
mongo_uri = 'mongodb://steemit:steemit@mongo1.steemdata.com:27017/SteemData' mongo_dbname = 'SteemData' pagination_default = 50 rate_limit_get = (1000, 60) status_err = 'ERROR' extra_response_fields = ['ID_FIELD'] allow_unknown = True x_domains = '*' domain = {'Accounts': {'id_field': 'name', 'item_lookup': True, 'addi...
def wait(c): m = None while m != 'GO': m = (c.recv(300).decode().replace('\n','').strip()) pass
def wait(c): m = None while m != 'GO': m = c.recv(300).decode().replace('\n', '').strip() pass
# -*- coding: utf-8 -*- """ morse.py Class for converting between English and morse code @author: Douglas Daly @date: 1/6/2017 """ # # Class Definition # class Morse(object): """ Morse Code Translation Class """ def __init__(self): """ Default Constructor """ dict_tup ...
""" morse.py Class for converting between English and morse code @author: Douglas Daly @date: 1/6/2017 """ class Morse(object): """ Morse Code Translation Class """ def __init__(self): """ Default Constructor """ dict_tup = self.__generate_morse_code_dictionaries() ...
class ResolveEventArgs(EventArgs): """ Provides data for loader resolution events,such as the System.AppDomain.TypeResolve,System.AppDomain.ResourceResolve,System.AppDomain.ReflectionOnlyAssemblyResolve,and System.AppDomain.AssemblyResolve events. ResolveEventArgs(name: str) ResolveEventArgs(name: str,...
class Resolveeventargs(EventArgs): """ Provides data for loader resolution events,such as the System.AppDomain.TypeResolve,System.AppDomain.ResourceResolve,System.AppDomain.ReflectionOnlyAssemblyResolve,and System.AppDomain.AssemblyResolve events. ResolveEventArgs(name: str) ResolveEventArgs(name: str,reque...
def pesquisa_binaria(lista, item): baixo = 0 alto = len(lista) - 1 while baixo <= alto: meio = (baixo + alto) // 2 chute = lista[meio] if chute == item: return meio elif chute > item: alto = meio - 1 elif chute < item: baixo = m...
def pesquisa_binaria(lista, item): baixo = 0 alto = len(lista) - 1 while baixo <= alto: meio = (baixo + alto) // 2 chute = lista[meio] if chute == item: return meio elif chute > item: alto = meio - 1 elif chute < item: baixo = meio ...
# _*_coding : UTF_8_*_ # Author :Jie Shen # CreatTime :2022/1/17 20:53 class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class BuildTree: def __init__(self): pass def build_by_array(self, arr) -> ListNode: if arr is None...
class Listnode: def __init__(self, val=0, next=None): self.val = val self.next = next class Buildtree: def __init__(self): pass def build_by_array(self, arr) -> ListNode: if arr is None or len(arr) == 0: return None head = list_node(arr[0]) nod...
# CAN THE WORD BE CONSTRUCTED? # Write a function 'can_construct(target, word_bank)' that accepts a # target string and an array of strings. # # The function should return a boolean indicating whether ot not the # 'target' can be constructed by concatenating elements of the 'word_bank' array. # # You may reuse e...
def can_construct_brute(target, word_bank): if target == '': return True for word in word_bank: if target.startswith(word): suffix = target[len(word):] if can_construct_brute(suffix, word_bank) == True: return True return False def can_construct_dp(ta...
class Mesh(object): 'Common class for all Mesh of the Finite Element Method.' def __init__(self): pass
class Mesh(object): """Common class for all Mesh of the Finite Element Method.""" def __init__(self): pass
# @Author Justin Noddell # def pagerank( G ): # params G *** a dict of pages and their respective links # returns a dict of pages and their respective pagerank values # # the purpose of this function is to execute the PageRank function def pagerank( G ): P = G.keys() # pages L = G.values() ...
def pagerank(G): p = G.keys() l = G.values() i = dict() r = dict() lambda = 0.2 tau = 0.02 for p in P: I[p] = 1 / len(P) R[p] = 0 converged = False while not converged: converged = True for r in R: R[r] = LAMBDA / len(P) for p in P:...
''' MSDP Genie Ops Object Outputs for IOSXE ''' class MsdpOutput(object): # 'show ip msdp peer' ShowIpMsdpPeer = { 'vrf': { 'default': { 'peer': { '10.1.100.4': { 'session_state': 'Up', 'pe...
""" MSDP Genie Ops Object Outputs for IOSXE """ class Msdpoutput(object): show_ip_msdp_peer = {'vrf': {'default': {'peer': {'10.1.100.4': {'session_state': 'Up', 'peer_as': 1, 'resets': '0', 'connect_source': 'Loopback0', 'connect_source_address': '10.1.100.2', 'elapsed_time': '00:41:18', 'statistics': {'queue': ...
word = input() while not word == "end": print(f"{word} = {word[::-1]}") word = input() # text = input() # while text != "end": # text_reversed = "" # for ch in reversed(text): # text_reversed += ch # print(text + " = " + text_reversed) # text = input()
word = input() while not word == 'end': print(f'{word} = {word[::-1]}') word = input()
entrada = int(input()) for i in range(0, entrada): A, B = input().split(" ") x, y = int(A), int(B) if y == 0: print("divisao impossivel") else: resultado = x / y print(f"{resultado:.1f}")
entrada = int(input()) for i in range(0, entrada): (a, b) = input().split(' ') (x, y) = (int(A), int(B)) if y == 0: print('divisao impossivel') else: resultado = x / y print(f'{resultado:.1f}')
""" Common functions for protocols. Protocols define, how the communication with a backend service works. They usually come with a FactoryFromService class, that adapts the backend service interface, and implements a factory interface. """
""" Common functions for protocols. Protocols define, how the communication with a backend service works. They usually come with a FactoryFromService class, that adapts the backend service interface, and implements a factory interface. """
def generate_state(state, desired_len): while len(state) < desired_len: b = "".join(str((int(s) + 1) % 2) for s in reversed(state)) state = state + "0" + b return state[:desired_len] def checksum(state): res = [] f = True while f or len(state) % 2 == 0: f = False r...
def generate_state(state, desired_len): while len(state) < desired_len: b = ''.join((str((int(s) + 1) % 2) for s in reversed(state))) state = state + '0' + b return state[:desired_len] def checksum(state): res = [] f = True while f or len(state) % 2 == 0: f = False r...
SCHEDULE_NONE = None SCHEDULE_HOURLY = '0 * * * *' SCHEDULE_DAILY = '0 0 * * *' SCHEDULE_WEEKLY = '0 0 * * 0' SCHEDULE_MONTHLY = '0 0 1 * *' SCHEDULE_YEARLY = '0 0 1 1 *'
schedule_none = None schedule_hourly = '0 * * * *' schedule_daily = '0 0 * * *' schedule_weekly = '0 0 * * 0' schedule_monthly = '0 0 1 * *' schedule_yearly = '0 0 1 1 *'
l = [*map(int, input().split())] r = 0 for i in l: if i > 0: r += 1 print(r)
l = [*map(int, input().split())] r = 0 for i in l: if i > 0: r += 1 print(r)
class Carbure: SUCCESS = "success" ERROR = "error" class CarbureError: INVALID_REGISTRATION_FORM = "Invalid registration form" INVALID_LOGIN_CREDENTIALS = "Invalid login or password" ACCOUNT_NOT_ACTIVATED = "Account not activated" OTP_EXPIRED_CODE = "OTP Code Expired" OTP_INVALID_CODE = "OT...
class Carbure: success = 'success' error = 'error' class Carbureerror: invalid_registration_form = 'Invalid registration form' invalid_login_credentials = 'Invalid login or password' account_not_activated = 'Account not activated' otp_expired_code = 'OTP Code Expired' otp_invalid_code = 'OT...
### Score - Linux P1_Wins = 0 CPU_Wins = 0 Game_Draws = 0
p1__wins = 0 cpu__wins = 0 game__draws = 0
# Merge Sort ''' Divide and Conquer Algorithm -> Divide: Divide equally until one element: each individual element is sorted -> Conquer: Combine elements by comparing ''' # Conquer def merge(arr,low,mid,high): # Create two arrays for two halves n1 = mid - low + 1; n2 = high - mid; # Declaring empty arr...
""" Divide and Conquer Algorithm -> Divide: Divide equally until one element: each individual element is sorted -> Conquer: Combine elements by comparing """ def merge(arr, low, mid, high): n1 = mid - low + 1 n2 = high - mid left = list() right = list() for i in range(n1): Left.append(0) ...
class Solution: def wordBreak(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ # iterative visited = [0] * (len(s) + 1) stack = [0] while stack: cur = stack.pop() print(cur) if...
class Solution: def word_break(self, s, wordDict): """ :type s: str :type wordDict: List[str] :rtype: bool """ visited = [0] * (len(s) + 1) stack = [0] while stack: cur = stack.pop() print(cur) if visited[cur] or cu...
DEFAULT_EQUIPMENT = [ ("Dumbbells","Generic dumbbells."), ("Barbell","Generic barbell with plate weights."), ("Squat Rack","Generic squat rack."), ("Leg Curl Machine","Generic machine to do leg curls on."), ("Leg Extension Machine","Generic machine to do leg extensions on."), ("Pull up bar","Generic horizontal bar to ...
default_equipment = [('Dumbbells', 'Generic dumbbells.'), ('Barbell', 'Generic barbell with plate weights.'), ('Squat Rack', 'Generic squat rack.'), ('Leg Curl Machine', 'Generic machine to do leg curls on.'), ('Leg Extension Machine', 'Generic machine to do leg extensions on.'), ('Pull up bar', 'Generic horizontal bar...
d = {2:0, 3:0, 4:0, 5:0} input() v = [int(x) for x in input().split()] for i in v: if i % 2 == 0: d[2] += 1 if i % 3 == 0: d[3] += 1 if i % 4 == 0: d[4] += 1 if i % 5 == 0: d[5] += 1 print(d[2], 'Multiplo(s) de 2') print(d[3], 'Multiplo(s) de 3') print(d[4], 'Multiplo(s) de 4') print(d[5], 'Multiplo(s) ...
d = {2: 0, 3: 0, 4: 0, 5: 0} input() v = [int(x) for x in input().split()] for i in v: if i % 2 == 0: d[2] += 1 if i % 3 == 0: d[3] += 1 if i % 4 == 0: d[4] += 1 if i % 5 == 0: d[5] += 1 print(d[2], 'Multiplo(s) de 2') print(d[3], 'Multiplo(s) de 3') print(d[4], 'Multiplo...
# Single line Comment """ Multi line Comment 1 Multi line Comment 2 """ print("Hello") print("Hello World") # By default end is new line charcter \n print("Hello", end=' & ') print("Hello World") print("Hello","Hello World", end=' ') print('Bye') print('Harry is \ngood boy ! Yes\t!') # \t for tab (6 spaces) , \' ...
""" Multi line Comment 1 Multi line Comment 2 """ print('Hello') print('Hello World') print('Hello', end=' & ') print('Hello World') print('Hello', 'Hello World', end=' ') print('Bye') print('Harry is \ngood boy ! Yes\t!') print(' ')
""" Space : O(1) Time : O(n) """ class NumArray: def __init__(self, nums: List[int]): self.nums = nums def update(self, i: int, val: int) -> None: self.nums[i] = val def sumRange(self, i: int, j: int) -> int: return sum(self.nums[i:j+1]) # Your NumArray object will be ins...
""" Space : O(1) Time : O(n) """ class Numarray: def __init__(self, nums: List[int]): self.nums = nums def update(self, i: int, val: int) -> None: self.nums[i] = val def sum_range(self, i: int, j: int) -> int: return sum(self.nums[i:j + 1])
def findDecision(obj): #obj[0]: Passanger, obj[1]: Weather, obj[2]: Time, obj[3]: Coupon, obj[4]: Coupon_validity, obj[5]: Gender, obj[6]: Age, obj[7]: Children, obj[8]: Education, obj[9]: Occupation, obj[10]: Income, obj[11]: Bar, obj[12]: Coffeehouse, obj[13]: Restaurant20to50, obj[14]: Direction_same, obj[15]: Dista...
def find_decision(obj): if obj[10] <= 5: if obj[13] <= 2.0: if obj[12] <= 3.0: if obj[9] > 5: if obj[3] > 3: return 'False' elif obj[3] <= 3: if obj[4] <= 0: return...
def test_limits(client): """Make sure that requesting resources with limits return a slice of the result.""" for i in range(100): badge = client.post("/api/event/1/badge", json={ "legal_name": "Test User {}".format(i) }).json assert(badge['legal_name'] == "Test User {}"...
def test_limits(client): """Make sure that requesting resources with limits return a slice of the result.""" for i in range(100): badge = client.post('/api/event/1/badge', json={'legal_name': 'Test User {}'.format(i)}).json assert badge['legal_name'] == 'Test User {}'.format(i) badges = clie...
# cook your dish here try: n = int(input()) print(n) except: pass
try: n = int(input()) print(n) except: pass
a, b = map(int, input().split()) if a+b < 24: print(a+b) else: print((a+b)-24)
(a, b) = map(int, input().split()) if a + b < 24: print(a + b) else: print(a + b - 24)
class Dog: """A simple attempt to model a dog""" def __init__(self, name, age): """Initialize name and age attributes""" self.name=name self.age=age def sit(self): """Simulate a dog sitting in response to a command""" print(f"{self.name} is now sitting") def roll_over(self): """Simulate rolling over ...
class Dog: """A simple attempt to model a dog""" def __init__(self, name, age): """Initialize name and age attributes""" self.name = name self.age = age def sit(self): """Simulate a dog sitting in response to a command""" print(f'{self.name} is now sitting') de...
# # PySNMP MIB module POLICY-DEVICE-AUX-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/POLICY-DEVICE-AUX-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:41:12 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (def...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) ...
{ 'targets': [ { 'target_name': 'binding', 'sources': [ './src/fb-bindings.cc', './src/fb-bindings-blob.cc', './src/fb-bindings-fbresult.cc', './src/fb-bindings-connection.cc','./src/fb-bindings-eventblock.cc', './src/fb-bindings-fbeventemitter....
{'targets': [{'target_name': 'binding', 'sources': ['./src/fb-bindings.cc', './src/fb-bindings-blob.cc', './src/fb-bindings-fbresult.cc', './src/fb-bindings-connection.cc', './src/fb-bindings-eventblock.cc', './src/fb-bindings-fbeventemitter.cc', './src/fb-bindings-statement.cc', './src/fb-bindings-transaction.cc'], 'i...
# Still waiting on what Neutral should be! ALIGNMENT_CHOICES = ( (0, 'Neutral'), (-1000, 'Evil'), (1000, 'Good'), ) SEX_CHOICES = ( (0, 'None'), (1, 'Male'), (2, 'Female'), ) WEAPON_TYPE_CHOICES = ( ('B', 'Blunt'), ('S', 'Sharp'), ) DIRECTION_CHOICES = ( (0, 'North'), ...
alignment_choices = ((0, 'Neutral'), (-1000, 'Evil'), (1000, 'Good')) sex_choices = ((0, 'None'), (1, 'Male'), (2, 'Female')) weapon_type_choices = (('B', 'Blunt'), ('S', 'Sharp')) direction_choices = ((0, 'North'), (1, 'East'), (2, 'South'), (3, 'West'), (4, 'Up'), (5, 'Down')) door_reset_choices = ((0, 'Open'), (1, '...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Oct 10 09:23:08 2018 @author: misskeisha """ s = input() def palindrome(s): if len(s) <= 1: return True else: return s[0] == s[-1] and palindrome(s[1:-1]) print(palindrome(s))
""" Created on Wed Oct 10 09:23:08 2018 @author: misskeisha """ s = input() def palindrome(s): if len(s) <= 1: return True else: return s[0] == s[-1] and palindrome(s[1:-1]) print(palindrome(s))
# break # for i in range(1, 10): # print(i) # if i == 3: # break # continue for i in range(1, 10): if i == 4 or i == 7: continue print(i)
for i in range(1, 10): if i == 4 or i == 7: continue print(i)
#Cambio , remplazo de cadena de Letras print("=================================================================") archivo_texto = open("archivo.txt","r+") # Archivo de Lectura y escritura lista_texto=archivo_texto.readlines() lista_texto[1]= " Estas linea ha sido incluioda desde el exterior 2 \n" archivo_texto.seek(0...
print('=================================================================') archivo_texto = open('archivo.txt', 'r+') lista_texto = archivo_texto.readlines() lista_texto[1] = ' Estas linea ha sido incluioda desde el exterior 2 \n' archivo_texto.seek(0) archivo_texto.writelines(lista_texto) archivo_texto.close()
# 07/01/2019 def upc(n): digits = [int(x) for x in f'{n:011}'] M = (sum(digits[0::2]) * 3 + sum(digits[1::2])) % 10 return 0 if M == 0 else 10 - M assert upc(4210000526) == 4 assert upc(3600029145) == 2 assert upc(12345678910) == 4 assert upc(1234567) == 0
def upc(n): digits = [int(x) for x in f'{n:011}'] m = (sum(digits[0::2]) * 3 + sum(digits[1::2])) % 10 return 0 if M == 0 else 10 - M assert upc(4210000526) == 4 assert upc(3600029145) == 2 assert upc(12345678910) == 4 assert upc(1234567) == 0
# -*- coding: utf-8 -*- # # dependencies documentation build configuration file, created by Quark extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.napoleon' ] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'dependencies' copyright = u'2015, dependencies authors' author = ...
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = u'dependencies' copyright = u'2015, dependencies authors' author = u'dependencies authors' version = '0.0.1' release = '0.0.1' language = None exclude_patterns = ['_build'] py...
while True: try: number = input('Please input hex number: ') print(int(number, 16)) except: break;
while True: try: number = input('Please input hex number: ') print(int(number, 16)) except: break
print('-'* 23) print('\033[:31mCALCULADOR DE DESCONTOS\033[m') print('-'* 23) p = float(input('Valor do produto: ')) desc = (p / 100) * 95 # -> p - (p * 5 / 100) print(f'O produto que custava {p:.2f} com desconto de 5% sae por: {desc:.2f}'.replace('.', ','))
print('-' * 23) print('\x1b[:31mCALCULADOR DE DESCONTOS\x1b[m') print('-' * 23) p = float(input('Valor do produto: ')) desc = p / 100 * 95 print(f'O produto que custava {p:.2f} com desconto de 5% sae por: {desc:.2f}'.replace('.', ','))
limak, bob = map(int, input().split()) years = 0 while limak <= bob: limak *= 3 bob *= 2 years += 1 print(years)
(limak, bob) = map(int, input().split()) years = 0 while limak <= bob: limak *= 3 bob *= 2 years += 1 print(years)
"""Top-level package for ascii-art.""" __author__ = """Zero to Mastery""" __version__ = '0.1.0'
"""Top-level package for ascii-art.""" __author__ = 'Zero to Mastery' __version__ = '0.1.0'
#Settings for running headless_tests DEVELOPMENT_SERVER_HOST='localhost' DEVELOPMENT_SERVER_PORT=8004 PHANTOMJS_GHOSTDRIVER_PORT=8150
development_server_host = 'localhost' development_server_port = 8004 phantomjs_ghostdriver_port = 8150
# -*- coding: utf-8 -*- MINIMUM_PULSE_CYCLE = 0.5 MAXIMUM_PULSE_CYCLE = 1.2 PPG_SAMPLE_RATE = 200 PPG_FIR_FILTER_TAP_NUM = 200 PPG_FILTER_CUTOFF = [0.5, 5.0] PPG_SYSTOLIC_PEAK_DETECTION_THRESHOLD_COEFFICIENT = 0.5 TRAINING_DATA_RATIO = 0.75
minimum_pulse_cycle = 0.5 maximum_pulse_cycle = 1.2 ppg_sample_rate = 200 ppg_fir_filter_tap_num = 200 ppg_filter_cutoff = [0.5, 5.0] ppg_systolic_peak_detection_threshold_coefficient = 0.5 training_data_ratio = 0.75
# Turns on debugging features in Flask DEBUG = True # secret key: SECRET_KEY = "MySuperSecretKey" # Database connection parameters DB_HOST = "127.0.0.1" DB_PORT = 27017 DB_NAME = "cgbeacon2-test" DB_URI = f"mongodb://{DB_HOST}:{DB_PORT}/{DB_NAME}" # standalone MongoDB instance # DB_URI = "mongodb://localhost:27011,l...
debug = True secret_key = 'MySuperSecretKey' db_host = '127.0.0.1' db_port = 27017 db_name = 'cgbeacon2-test' db_uri = f'mongodb://{DB_HOST}:{DB_PORT}/{DB_NAME}' organisation = dict(id='scilifelab', name='Clinical Genomics, SciLifeLab', description='A science lab', address='', contactUrl='', info=[], logoUrl='', welcom...
string_input = input() num = int(input()) # def string(str, n): # new_string = "" # for i in range(0, n): # new_string += str # return new_string # def string(str, n): # return str*n # Recursion def string(str, n): if n < 1: return "" return str + string(str, n=n - 1) prin...
string_input = input() num = int(input()) def string(str, n): if n < 1: return '' return str + string(str, n=n - 1) print(string(string_input, num))
def add_node(v): if v in graph: print(v,"already present") else: graph[v]=[] def add_edge(v1,v2): if v1 not in graph: print(v1," not present in graph") elif v2 not in graph: print(v2,"not present in graph") else: graph[v1].append(v2) graph[v2].append(...
def add_node(v): if v in graph: print(v, 'already present') else: graph[v] = [] def add_edge(v1, v2): if v1 not in graph: print(v1, ' not present in graph') elif v2 not in graph: print(v2, 'not present in graph') else: graph[v1].append(v2) graph[v2].a...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Prince Prigio chart = ["accept", "allow", "apologise", "appeal", "appear", "approve", "await", "bear", "beat", "behave", "behold", "better", "brawl", "breed", "build", "christen", "claim", "complain", "correct", "count", "cover", "creep", "curl", "decline", "deserve", "de...
chart = (['accept', 'allow', 'apologise', 'appeal', 'appear', 'approve', 'await', 'bear', 'beat', 'behave', 'behold', 'better', 'brawl', 'breed', 'build', 'christen', 'claim', 'complain', 'correct', 'count', 'cover', 'creep', 'curl', 'decline', 'deserve', 'despise', 'disappear', 'distress', 'shun', 'draw', 'drop', 'eat...
#! python # Problem # : 236A # Created on : 2019-01-14 23:41:28 def Main(): cnt = len(set(input())) print('IGNORE HIM!' if cnt & 1 else 'CHAT WITH HER!') if __name__ == '__main__': Main()
def main(): cnt = len(set(input())) print('IGNORE HIM!' if cnt & 1 else 'CHAT WITH HER!') if __name__ == '__main__': main()
class Node: def __init__(self, index): self.index = index self.visited = False self._neighbors = [] def __repr__(self): return str(self.index) @property def neighbors(self): return self._neighbors @neighbors.setter def neighbors(self, neighbor):...
class Node: def __init__(self, index): self.index = index self.visited = False self._neighbors = [] def __repr__(self): return str(self.index) @property def neighbors(self): return self._neighbors @neighbors.setter def neighbors(self, neighbor): ...
""" dummy tests """ #============================ helpers ========================================= #============================ tests =========================================== def test_dummy(): pass
""" dummy tests """ def test_dummy(): pass
# https://leetcode.com/problems/maximum-product-difference-between-two-pairs class Solution: def maxProductDifference(self, nums: List[int]) -> int: nums = sorted(nums) return (nums[-1] * nums[-2]) - (nums[0] * nums[1])
class Solution: def max_product_difference(self, nums: List[int]) -> int: nums = sorted(nums) return nums[-1] * nums[-2] - nums[0] * nums[1]
""" Contains functions implementing the Levenshtein distance algorithm. """ def relative(a, b): """Returns the relative distance between two strings, in the range [0-1] where 1 means total equality. """ d = distance(a,b) longer = float(max((len(a), len(b)))) shorter = float(min((len(a...
""" Contains functions implementing the Levenshtein distance algorithm. """ def relative(a, b): """Returns the relative distance between two strings, in the range [0-1] where 1 means total equality. """ d = distance(a, b) longer = float(max((len(a), len(b)))) shorter = float(min((len(a), len(b)...
# Space: O(n) # Time: O(n) class Solution: def plusOne(self, digits): temp = ''.join(map(lambda x: str(x), digits)) temp = int(temp) + 1 temp = list(str(temp)) return list(map(lambda x: int(x), temp))
class Solution: def plus_one(self, digits): temp = ''.join(map(lambda x: str(x), digits)) temp = int(temp) + 1 temp = list(str(temp)) return list(map(lambda x: int(x), temp))
#Explain your work #Question 1 for x in range(a): print(a)
for x in range(a): print(a)
#!/usr/bin/python3 words = """art hue ink oil pen wax clay draw film form kiln line tone tube wood batik brush carve chalk color craft easel erase frame gesso glass glaze image latex liner media mixed model mural paint paper photo print quill quilt ruler scale shade stone style tools video wheel artist bridge canvas ch...
words = 'art\nhue\nink\noil\npen\nwax\nclay\ndraw\nfilm\nform\nkiln\nline\ntone\ntube\nwood\nbatik\nbrush\ncarve\nchalk\ncolor\ncraft\neasel\nerase\nframe\ngesso\nglass\nglaze\nimage\nlatex\nliner\nmedia\nmixed\nmodel\nmural\npaint\npaper\nphoto\nprint\nquill\nquilt\nruler\nscale\nshade\nstone\nstyle\ntools\nvideo\nwhe...
# Licensed under an MIT open source license - see LICENSE def generate_saa_list(scouseobject): """ Returns a list constaining all spectral averaging areas. Parameters ---------- scouseobject : Instance of the scousepy class """ saa_list=[] for i in range(len(scouseobject.wsaa)): ...
def generate_saa_list(scouseobject): """ Returns a list constaining all spectral averaging areas. Parameters ---------- scouseobject : Instance of the scousepy class """ saa_list = [] for i in range(len(scouseobject.wsaa)): saa_dict = scouseobject.saa_dict[i] for key in...
class Sentence: def __init__(self): self._tokens = [] self._metadata = [] def append_metadata(self, data): self._metadata.append(data) def append_token(self, token): self._tokens.append(token) def __bool__(self): return len(self._tokens) > 0 def __len__(se...
class Sentence: def __init__(self): self._tokens = [] self._metadata = [] def append_metadata(self, data): self._metadata.append(data) def append_token(self, token): self._tokens.append(token) def __bool__(self): return len(self._tokens) > 0 def __len__(s...
class AppSettings: allow_extra_fields = True types = { # Slack 'domain': str, # come on, Okta, be consistent... # T-Sheets 'subDomain': str, # Engagedly 'acsUrl': str, # ACS URL 'audRestriction': str, # Entity ID # JIRA 'baseURL...
class Appsettings: allow_extra_fields = True types = {'domain': str, 'subDomain': str, 'acsUrl': str, 'audRestriction': str, 'baseURL': str, 'companyName': str, 'url': str, 'requestIntegration': bool, 'authURL': str, 'usernameField': str, 'passwordField': str, 'buttonField': str, 'extraFieldSelector': str, 'ext...
N, K = map(int, input().split()) S = list(input()) Y = 0 if N == 1: print(0) exit(0) if S[0] == 'L': Y += 1 if S[N-1] == 'R': Y += 1 count = 0 X = 0 for i in range(N-1): if S[i] == 'R' and S[i+1] == 'L': X += 1 if S[i] == S[i+1]: count += 1 count += K*2 print(min(N-1, count)) ...
(n, k) = map(int, input().split()) s = list(input()) y = 0 if N == 1: print(0) exit(0) if S[0] == 'L': y += 1 if S[N - 1] == 'R': y += 1 count = 0 x = 0 for i in range(N - 1): if S[i] == 'R' and S[i + 1] == 'L': x += 1 if S[i] == S[i + 1]: count += 1 count += K * 2 print(min(N - ...
# # PySNMP MIB module CTRON-ROUTERS-INTERNAL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CTRON-ROUTERS-INTERNAL-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:15:01 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version ...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, constraints_intersection, value_range_constraint, value_size_constraint, constraints_union) ...
# -*- coding: utf-8 -*- class Solution: def distributeCandies(self, candies): return min(len(candies) / 2, len(set(candies))) if __name__ == '__main__': solution = Solution() assert 3 == solution.distributeCandies([1, 1, 2, 2, 3, 3]) assert 2 == solution.distributeCandies([1, 1, 2, 3])
class Solution: def distribute_candies(self, candies): return min(len(candies) / 2, len(set(candies))) if __name__ == '__main__': solution = solution() assert 3 == solution.distributeCandies([1, 1, 2, 2, 3, 3]) assert 2 == solution.distributeCandies([1, 1, 2, 3])
#author: n01 """ Useful termcolor attributes (attrs for short) @Usage: colored("stringa", COLOR, attrs=ATTRIBUTE) These attributes are list with a single element to create longer list just add the attributes together e.g. BLINK + BOLD gives you ['blink', 'bold'] """ BLINK = ["blink"] BOLD = ["bold"] DARK = ["dark"] UN...
""" Useful termcolor attributes (attrs for short) @Usage: colored("stringa", COLOR, attrs=ATTRIBUTE) These attributes are list with a single element to create longer list just add the attributes together e.g. BLINK + BOLD gives you ['blink', 'bold'] """ blink = ['blink'] bold = ['bold'] dark = ['dark'] underline = ['un...
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" The MIT License (MIT) Copyright (c) 2016 WavyCloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, p...
""" Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. Example "abcde" -> 0 # no characters repeats ...
""" Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphabets (both uppercase and lowercase) and numeric digits. Example "abcde" -> 0 # no characters repeats ...
# # PySNMP MIB module ELTEX-MES-IP (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ELTEX-MES-IP # Produced by pysmi-0.3.4 at Wed May 1 13:00:06 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,...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, single_value_constraint, value_size_constraint, constraints_intersection) ...
def print_full_name(a, b): first_name = a last_name = b print("Hello", first_name, last_name + "!", "You just delved into python.")
def print_full_name(a, b): first_name = a last_name = b print('Hello', first_name, last_name + '!', 'You just delved into python.')
opt = { # LRC1000.0 'a9a.LRC1000.0': 1.05049605396498e+07, # from TRON 'a9a.bias.LRC1000.0': 1.05049602719930e+07, # from TRON 'covtype.libsvm.binary.LRC1000.0': 2.98341912891832e+08, # from nheavy 'covtype.libsvm.binary.bias.LRC1000.0': 2.98341823726758e+08, # fro...
opt = {'a9a.LRC1000.0': 10504960.5396498, 'a9a.bias.LRC1000.0': 10504960.271993, 'covtype.libsvm.binary.LRC1000.0': 298341912.891832, 'covtype.libsvm.binary.bias.LRC1000.0': 298341823.726758, 'epsilon_normalized.LRC1000.0': 100427474.936523, 'epsilon_normalized.bias.LRC1000.0': 100427449.600054, 'kddb.LRC1000.0': 40814...
# encoding=utf-8 def my_coroutine(): while True: received = yield print('Received:',received) it = my_coroutine() next(it) it.send('First') it.send('Second') def minimize(): current = yield while True: value = yield current current = min(value,current) it = minimize() next(it) print(it.send(10)) prin...
def my_coroutine(): while True: received = (yield) print('Received:', received) it = my_coroutine() next(it) it.send('First') it.send('Second') def minimize(): current = (yield) while True: value = (yield current) current = min(value, current) it = minimize() next(it) print(...
class Solution(object): def groupAnagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ anagram = {} for i in strs: count = [0]*26 for c in i: count[ord(c) - ord('a')] += 1 count = tuple(count) ...
class Solution(object): def group_anagrams(self, strs): """ :type strs: List[str] :rtype: List[List[str]] """ anagram = {} for i in strs: count = [0] * 26 for c in i: count[ord(c) - ord('a')] += 1 count = tuple(coun...
''' File name: p1_utils.py Author: Date: '''
""" File name: p1_utils.py Author: Date: """
""" Implementation of Merge Sort algorithm """ def merge(data): """ MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. :param array: list of elements that needs to be sorted :type array: list ...
""" Implementation of Merge Sort algorithm """ def merge(data): """ MergeSort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. :param array: list of elements that needs to be sorted :type array: list ...
DAILY='DAILY' WEEKLY='WEEKLY' MONTHLY='MONTHLY' ANNUALLY='ANNUALLY' MONTHLY_MEAN='MONTHLY_MEAN' ANNUAL_MEAN='ANNUAL_MEAN' MONTHLY_SUM='MONTHLY_SUM' ANNUAL_SUM='ANNUAL_SUM' MONTHLY_SNAPSHOT='MONTHLY_SNAPSHOT' ANNUAL_SNAPSHOT='ANNUAL_SNAPSHOT'
daily = 'DAILY' weekly = 'WEEKLY' monthly = 'MONTHLY' annually = 'ANNUALLY' monthly_mean = 'MONTHLY_MEAN' annual_mean = 'ANNUAL_MEAN' monthly_sum = 'MONTHLY_SUM' annual_sum = 'ANNUAL_SUM' monthly_snapshot = 'MONTHLY_SNAPSHOT' annual_snapshot = 'ANNUAL_SNAPSHOT'
"""Top-level package for Ansible Events.""" __author__ = """Ben Thomasson""" __email__ = 'ben.thomasson@gmail.com' __version__ = '0.4.0'
"""Top-level package for Ansible Events.""" __author__ = 'Ben Thomasson' __email__ = 'ben.thomasson@gmail.com' __version__ = '0.4.0'
# # PySNMP MIB module RFC1406Ext-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RFC1406Ext-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:56:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ...
MAPPING = [ { 'sid': 'Adult age binary (yes)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 55, 'endorsed': True, }, { 'sid': 'Adult age binary (no)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 45, 'endorsed': False, ...
mapping = [{'sid': 'Adult age binary (yes)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 55, 'endorsed': True}, {'sid': 'Adult age binary (no)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 45, 'endorsed': False}, {'sid': 'Adult age binary (no-lower bound)', 'symptom': 'age', 'module': 'adult', 'gen_5_4a': 12,...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # let's create several lists alist1 = [1, 2, 3, 4, 5] alist2 = ['a', 'b', 'c', 'd', 'e'] alist3 = [] # empty list alist4 = list() # Also creates an empty list. As an argument, anything iterable can be used and a list is created from it. print(len(alist1)) # The buil...
alist1 = [1, 2, 3, 4, 5] alist2 = ['a', 'b', 'c', 'd', 'e'] alist3 = [] alist4 = list() print(len(alist1)) print(alist1[0]) print(alist1[-1]) print(alist1) alist1[0] = 100 print(alist1) alist1[1:3] = [101, 102, 103] print(alist1) alist1[len(alist1):] = [6] print(alist1) alist1.append(7) print(alist1) alist1[5:] = [] pr...
__all__ = [ 'feature_audio_adpcm', \ 'feature_audio_adpcm_sync', \ 'bv_audio_sync_manager' ]
__all__ = ['feature_audio_adpcm', 'feature_audio_adpcm_sync', 'bv_audio_sync_manager']
x = int(input()) a = list(map(int,input().split())) y = int(input()) b = list(map(int,input().split())) f=[] for i in b: for j in a: if i%j==0: f.append(i/j) print(f.count(max(f)))
x = int(input()) a = list(map(int, input().split())) y = int(input()) b = list(map(int, input().split())) f = [] for i in b: for j in a: if i % j == 0: f.append(i / j) print(f.count(max(f)))
class mystery(object): def __init__(this, length, values): this.values = [0]*length for value in values: this.values[value] += 1 def __str__(this): return "length {:d}: {}".format(len(this.values), this.values) def __add__(this, value): myst = mystery(len(this.v...
class Mystery(object): def __init__(this, length, values): this.values = [0] * length for value in values: this.values[value] += 1 def __str__(this): return 'length {:d}: {}'.format(len(this.values), this.values) def __add__(this, value): myst = mystery(len(thi...
# coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control class Version: def __init__(self, version): self._p = version.split('.') self._v = version def __getitem__(self, key): return self._p[key] def __str__(self): return self._v d...
class Version: def __init__(self, version): self._p = version.split('.') self._v = version def __getitem__(self, key): return self._p[key] def __str__(self): return self._v def __repr__(self): return self._v __version__ = version('0.1.dev5+ge0d057d.d20210625')
def get_pair_number(list_pairs, item_left, item_right): # Retrieve pair number found = False ct_pair = 0 iter_pair = 0 while not found: if list_pairs[iter_pair, 0] == item_left and list_pairs[iter_pair, 1] == item_right: ct_pair = iter_pair found = True else: ...
def get_pair_number(list_pairs, item_left, item_right): found = False ct_pair = 0 iter_pair = 0 while not found: if list_pairs[iter_pair, 0] == item_left and list_pairs[iter_pair, 1] == item_right: ct_pair = iter_pair found = True else: iter_pair += 1 ...