content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
DOMAIN = { '20191016_1571241600': {'datasource': {'source': '20191016_1571241600'}}, '20191210_1575997200': {'datasource': {'source': '20191210_1575997200'}}, '20190724_1563969600': {'datasource': {'source': '20190724_1563969600'}}, '20191128_1574982000': {'datasource': {'source': '20191128_...
domain = {'20191016_1571241600': {'datasource': {'source': '20191016_1571241600'}}, '20191210_1575997200': {'datasource': {'source': '20191210_1575997200'}}, '20190724_1563969600': {'datasource': {'source': '20190724_1563969600'}}, '20191128_1574982000': {'datasource': {'source': '20191128_1574982000'}}, '20191029_1572...
# pylint: skip-file class Hostgroup(object): ''' hostgroup methods''' @staticmethod def get_host_group_id_by_name(zapi, hg_name): '''Get hostgroup id by name''' content = zapi.get_content('hostgroup', 'get', {'filter': {'...
class Hostgroup(object): """ hostgroup methods""" @staticmethod def get_host_group_id_by_name(zapi, hg_name): """Get hostgroup id by name""" content = zapi.get_content('hostgroup', 'get', {'filter': {'name': hg_name}}) return content['result'][0]['groupid'] @staticmethod de...
# Python - Object Oriented Programming # Raise can be different for different employees or instances. # But total number of employees will not be different for any instance. # so lets create a class variable names num_of employees. class Employee: num_of_emps = 0 raise_amt = 1.04 def __init__(self, firstN...
class Employee: num_of_emps = 0 raise_amt = 1.04 def __init__(self, firstName, lastName, pay): self.firstName = firstName self.lastName = lastName self.pay = pay self.email = f'{firstName}.{lastName}@Company.com' Employee.num_of_emps += 1 def fullname(self): ...
# Split string at line boundaries file_split = file.splitlines() # Print file_split print(file_split) # Complete for-loop to split by commas for substring in file_split: substring_split = substring.split(",") print(substring_split)
file_split = file.splitlines() print(file_split) for substring in file_split: substring_split = substring.split(',') print(substring_split)
#!/usr/bin/python # coding=utf-8 class Project(object): __allowed_properties = [ 'name', 'git_url', 'absolute_path' ] def __new__(cls, project_settings): # Check if project settings are a go for setting attributes if not sorted(project_settings.keys()) == sorted(c...
class Project(object): __allowed_properties = ['name', 'git_url', 'absolute_path'] def __new__(cls, project_settings): if not sorted(project_settings.keys()) == sorted(cls.__allowed_properties): return None for allowed_property in cls.__allowed_properties: setattr(cls, a...
# -*- coding: utf-8 -*- """ Created on Mon Apr 23 20:07:08 2018 @author: Shen Zhen-Xiong """ BasisDict = {'LDAmin': {'H': 'H_lda_5.0au_50Ry_2s1p', 'Li': 'Li_lda_8.0au_50Ry_2s2p1d', 'Be': 'Be_lda_8.0au_50Ry_2s2p1d', 'B': 'B_lda_7.0au_50Ry_...
""" Created on Mon Apr 23 20:07:08 2018 @author: Shen Zhen-Xiong """ basis_dict = {'LDAmin': {'H': 'H_lda_5.0au_50Ry_2s1p', 'Li': 'Li_lda_8.0au_50Ry_2s2p1d', 'Be': 'Be_lda_8.0au_50Ry_2s2p1d', 'B': 'B_lda_7.0au_50Ry_2s2p1d', 'C': 'C_pz-vbc_6.0au_50Ry_2s2d1p', 'N': 'N_lda_5.0au_50Ry_2s2p1d', 'O': 'O_lda_5.0au_50Ry_2s2p1...
""" Unit test module How to debug test: $ pytest -s # disable all capturing """
""" Unit test module How to debug test: $ pytest -s # disable all capturing """
class Building: def __init__(s,x,y,a,b,h=10): s.x,s.y,s.a,s.b,s.h=x,y,a,b,h __repr__ = lambda s: "Building({}, {}, {}, {}, {})".format(s.x,s.y,s.a,s.b,s.h) area,volume = lambda s: s.a*s.b,lambda s: s.a*s.b*s.h corners = lambda s: {"south-west":(s.x,s.y),"north-east":(s.x+s.b,s.y+s.a), ...
class Building: def __init__(s, x, y, a, b, h=10): (s.x, s.y, s.a, s.b, s.h) = (x, y, a, b, h) __repr__ = lambda s: 'Building({}, {}, {}, {}, {})'.format(s.x, s.y, s.a, s.b, s.h) (area, volume) = (lambda s: s.a * s.b, lambda s: s.a * s.b * s.h) corners = lambda s: {'south-west': (s.x, s.y), 'no...
##for i in range(0,5): ## for j in range(5,i,-1): ## ## print(j,end='') ## ## ## print() for i in range(5,0,-1): for j in range(1,i+1): print(i,end='') print()
for i in range(5, 0, -1): for j in range(1, i + 1): print(i, end='') print()
class User: def __init__(self, user_name, email=None): self.name = user_name self.email = email self.expense_dict = {} def add_entry(self, user, amount): print(f"Now updating Entry {user.name} for {self.name}'s dict.") if self.expense_dict.get(user, None) is not None: print(f"Previous entry was {self.ex...
class User: def __init__(self, user_name, email=None): self.name = user_name self.email = email self.expense_dict = {} def add_entry(self, user, amount): print(f"Now updating Entry {user.name} for {self.name}'s dict.") if self.expense_dict.get(user, None) is not None: ...
_base_ = [ '../_base_/models/oscar/oscar_nlvr2_config.py', '../_base_/datasets/oscar/oscar_nlvr2_dataset.py', '../_base_/default_runtime.py', ] # cover the parrmeter in above files model = dict(params=dict(model_name_or_path='/home/datasets/mix_data/model/vinvl/vqa/large/checkpoint-2000000', )) lr_config...
_base_ = ['../_base_/models/oscar/oscar_nlvr2_config.py', '../_base_/datasets/oscar/oscar_nlvr2_dataset.py', '../_base_/default_runtime.py'] model = dict(params=dict(model_name_or_path='/home/datasets/mix_data/model/vinvl/vqa/large/checkpoint-2000000')) lr_config = dict(num_warmup_steps=5000, num_training_steps=36000) ...
class Required(object): """ A class holding a dictionary of required fields for variety of transaction supported by pypesa """ re_customer_to_bussiness = { "input_Amount", "input_Country", "input_Currency", "input_CustomerMSISDN", "input_ServiceProvide...
class Required(object): """ A class holding a dictionary of required fields for variety of transaction supported by pypesa """ re_customer_to_bussiness = {'input_Amount', 'input_Country', 'input_Currency', 'input_CustomerMSISDN', 'input_ServiceProviderCode', 'input_ThirdPartyConversationID',...
mcl = [[-5.592134638754766e-05, 1e6], [-6.441295571105171e-05, 1e6], [-2.7292256647813406e-05, 1e6], [-5.738494934280777e-05, 1e6], [-3.920474118683737e-05, 1e6]] accval, accruns = 0, 0 for mcrun in mcl: accval += mcrun[0]*mcrun[1] accruns += mcrun[1] print(accruns, ': ', accva...
mcl = [[-5.592134638754766e-05, 1000000.0], [-6.441295571105171e-05, 1000000.0], [-2.7292256647813406e-05, 1000000.0], [-5.738494934280777e-05, 1000000.0], [-3.920474118683737e-05, 1000000.0]] (accval, accruns) = (0, 0) for mcrun in mcl: accval += mcrun[0] * mcrun[1] accruns += mcrun[1] print(accruns, ': ',...
greet=' hello bob ' greet.strip() print(greet) #right strip greet=' hello bob ' greet.rstrip() print(greet) #left strip greet=' hello bob ' greet.lstrip() print(greet)
greet = ' hello bob ' greet.strip() print(greet) greet = ' hello bob ' greet.rstrip() print(greet) greet = ' hello bob ' greet.lstrip() print(greet)
# # PySNMP MIB module CPQSANAPP-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CPQSANAPP-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:12:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ...
class Factorial: def __init__(self): self.fact = [1] def __call__(self,n): if n < len(self.fact): return 1 else: fact_number = n * self(n-1) self.fact.append(fact_number) return self.fact[n] factorial_of_n = Factorial() n = int(input("n = ")) print(factorial_of_n(n))
class Factorial: def __init__(self): self.fact = [1] def __call__(self, n): if n < len(self.fact): return 1 else: fact_number = n * self(n - 1) self.fact.append(fact_number) return self.fact[n] factorial_of_n = factorial() n = int(input('n = ...
def permutation(text, anchor, p): if anchor == len(text): p.add("".join(text)) return for i in range(anchor, len(text)): text[anchor], text[i] = text[i], text[anchor] permutation(text, anchor + 1, p) text[anchor], text[i] = text[i], text[anchor] if __name__ == "__main__": text = "abc" p = ...
def permutation(text, anchor, p): if anchor == len(text): p.add(''.join(text)) return for i in range(anchor, len(text)): (text[anchor], text[i]) = (text[i], text[anchor]) permutation(text, anchor + 1, p) (text[anchor], text[i]) = (text[i], text[anchor]) if __name__ == '__...
_config = { "class": "class" } def config(): return _config
_config = {'class': 'class'} def config(): return _config
fixthis = """ YOUR STORY GOES HERE """
fixthis = '\nYOUR STORY GOES HERE\n\n'
######################## GLOBAL VARIABLES ######################### BINANCE = True # Variable to indicate which exchange to use: True for BINANCE, False for FTX SHITCOIN = 'ftm' MULTI_TF = True TF_LIST = ['4h','1h','15m','5m','1m'] TF = '1h' LEVELS_PER_TF = 3 # Number of levels per Time Frame to include in the list of ...
binance = True shitcoin = 'ftm' multi_tf = True tf_list = ['4h', '1h', '15m', '5m', '1m'] tf = '1h' levels_per_tf = 3 days_back = 90 trade_on = False max_bal_per_coin = 10 lvrg = 20 tpgrid_min_dist = 0.2 tpgrid_max_dist = 0.8 tp_orders = 6 dca_factor_mult = 1.75 assymmetric_tp = False min_level_distance = 0.8
# https://codeforces.com/problemset/problem/266/A n = int(input()) s = input() ans = 0 for i in range(n - 1): if s[i] == s[i + 1]: ans += 1 print(ans)
n = int(input()) s = input() ans = 0 for i in range(n - 1): if s[i] == s[i + 1]: ans += 1 print(ans)
def generate_list(): output_list = [x ** 2 for x in list(range(1, 21))] print(output_list) generate_list()
def generate_list(): output_list = [x ** 2 for x in list(range(1, 21))] print(output_list) generate_list()
class DynamoDataAttribute(object): def __init__(self, datatype, value=None, initialized=True): """initialize the DynamoDataAttribute This class stores the current value of the attribute on the model and some extra metadata about the attribute itself datatype - the Datatype of the co...
class Dynamodataattribute(object): def __init__(self, datatype, value=None, initialized=True): """initialize the DynamoDataAttribute This class stores the current value of the attribute on the model and some extra metadata about the attribute itself datatype - the Datatype of the c...
def assert_modal_view_shown(running_app, klass=None): assert running_app.root_window.children if klass: klass_found = False children = running_app.root_window.children for child in children: klass_found |= isinstance(child, klass) assert klass_found, "%s modal view no...
def assert_modal_view_shown(running_app, klass=None): assert running_app.root_window.children if klass: klass_found = False children = running_app.root_window.children for child in children: klass_found |= isinstance(child, klass) assert klass_found, '%s modal view no...
#!/usr/bin/env python3 def check_kwarg(kwargs, name, default=None, arg_type=None, required=False, pop=False): """ Simple function for checking a kwarg. Useful if you don't want to create a new object to check a kwarg or two. Pop=True will remove the kwarg entry from kwargs if found. """ if required: ...
def check_kwarg(kwargs, name, default=None, arg_type=None, required=False, pop=False): """ Simple function for checking a kwarg. Useful if you don't want to create a new object to check a kwarg or two. Pop=True will remove the kwarg entry from kwargs if found. """ if required: assert name in kw...
# Alexa skill APPLICATION_ID: str = "amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0" RESPONSE_VERSION: str = "1.0" # Bible API BIBLE_TRANSLATION = "GNBDC" # Can't use NIV - it's still in copyright BIBLE_API_URL = f"https://bibles.org/v2/eng-{BIBLE_TRANSLATION}/passages.js" # Bible Passages BIBLE_PASSAGES_CSV_U...
application_id: str = 'amzn1.ask.skill.dd677950-cade-4805-b1f1-ce2e3a3569f0' response_version: str = '1.0' bible_translation = 'GNBDC' bible_api_url = f'https://bibles.org/v2/eng-{BIBLE_TRANSLATION}/passages.js' bible_passages_csv_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQqiE5BF-VtKfaV9NtpwYqgT3Ijw5pRmfb...
def sum_array(arr): if arr == None: return 0 if len(arr) == 0 or 1: return 0 else: x = max(arr) y = min(arr) arr.remove(x) arr.remove(y) return(sum(arr)) print(sum_array([1,2,3,4,4]))
def sum_array(arr): if arr == None: return 0 if len(arr) == 0 or 1: return 0 else: x = max(arr) y = min(arr) arr.remove(x) arr.remove(y) return sum(arr) print(sum_array([1, 2, 3, 4, 4]))
# ------------------------------------------------------------------------------ # Access to the CodeHawk Binary Analyzer Analysis Results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2020 Kestrel Technology LLC # #...
class Mipsregisterbase(object): def __init__(self, bd, index, tags, args): self.bd = bd self.index = index self.tags = tags self.args = args def is_mips_register(self): return False def is_mips_stack_pointer(self): return False def is_mips_argument_reg...
class TemplateBindingExtension(MarkupExtension): """ Implements a markup extension that supports the binding between the value of a property in a template and the value of some other exposed property on the templated control. TemplateBindingExtension() TemplateBindingExtension(property: DependencyProperty...
class Templatebindingextension(MarkupExtension): """ Implements a markup extension that supports the binding between the value of a property in a template and the value of some other exposed property on the templated control. TemplateBindingExtension() TemplateBindingExtension(property: DependencyProperty) ...
def print_bigger_number(first, second): if first > second: print(first) else: print(second)
def print_bigger_number(first, second): if first > second: print(first) else: print(second)
def palindrome(number): return number == number[::-1] if __name__ == '__main__': init = int(input()) number = init + 1 while not palindrome(str(number)): number += 1 print(number - init)
def palindrome(number): return number == number[::-1] if __name__ == '__main__': init = int(input()) number = init + 1 while not palindrome(str(number)): number += 1 print(number - init)
""" Logforce request settings file """ USERNAME = '' PASSWORD = '' CLIENT_VERSION = '4.3.0.0' URLS = { 'development':'', 'test':'', 'production':'' }
""" Logforce request settings file """ username = '' password = '' client_version = '4.3.0.0' urls = {'development': '', 'test': '', 'production': ''}
# bad practice: I/O inside the function def say_hello(): name = input('enter a name: ') print('hello ' + name) # say_hello() # best practice: No I/O in the function def say_hello2(name): msg = 'hello ' + name msg += '\nPleased to meet you' return msg print(say_hello2('Ahmed')) name1 = input('e...
def say_hello(): name = input('enter a name: ') print('hello ' + name) def say_hello2(name): msg = 'hello ' + name msg += '\nPleased to meet you' return msg print(say_hello2('Ahmed')) name1 = input('enter a name: ') result = say_hello2(name1) result += '\nWelcome to python II' print(result)
# All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA. # Write a function to find all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. # E...
class Solution(object): def find_repeated_dna_sequences(self, s): """ :type s: str :rtype: List[str] """ if not s or len(s) == 1: return [] store = set() res = set() for i in range(len(s) - 9): if s[i:i + 10] in store: ...
def main(): # Declare nucleotide variables [Adenine, Cytosine, Guanine, Thymine] A = 0; C = 0; G = 0; T = 0; # Manage input file input = open(r"C:\Users\lawht\Desktop\Github\ROSALIND\Bioinformatics Stronghold\(1) Counting DNA Nucleotides\Counting DNA Nucleotides\rosalind_dna.txt","r"); ...
def main(): a = 0 c = 0 g = 0 t = 0 input = open('C:\\Users\\lawht\\Desktop\\Github\\ROSALIND\\Bioinformatics Stronghold\\(1) Counting DNA Nucleotides\\Counting DNA Nucleotides\\rosalind_dna.txt', 'r') dna_string = input.readline() count_nucleotides(DNA_string, A, C, G, T) input.close() ...
def get_template_filter(): return example_filter2 def example_filter2(string): return "Example2: " + string
def get_template_filter(): return example_filter2 def example_filter2(string): return 'Example2: ' + string
### Migratory Birds - Solution def migratoryBirds(type_nums): count = [0] * len(type_nums) for i in type_nums: count[i] += 1 min_id = count.index(max(count)) print(min_id) birds = int(input()) type_nums = tuple(map(int, input().split()[:birds])) migratoryBirds(type_nums)
def migratory_birds(type_nums): count = [0] * len(type_nums) for i in type_nums: count[i] += 1 min_id = count.index(max(count)) print(min_id) birds = int(input()) type_nums = tuple(map(int, input().split()[:birds])) migratory_birds(type_nums)
def transpose(matrix): return map(list, zip(*matrix)) M = [[1,2,3], [4,5,6]] print(transpose(M))
def transpose(matrix): return map(list, zip(*matrix)) m = [[1, 2, 3], [4, 5, 6]] print(transpose(M))
class Node: def __init__(self, data, parent): self.data = data self.parent = parent self.right_node = None self.left_node = None class BinarySearchTree: def __init__(self): self.root = None def remove(self, data): if self.root: ...
class Node: def __init__(self, data, parent): self.data = data self.parent = parent self.right_node = None self.left_node = None class Binarysearchtree: def __init__(self): self.root = None def remove(self, data): if self.root: self.remove_node...
""" Functions for easily setting up Tkinter window settings Author: Marco P. L. Ribeiro Date: June 2019 MIT License Copyright (c) 2019 Marco P. L. Ribeiro """ def configure_window(master, title="Python Application", width=600, height=600, resizable=True, centred=True, bg=None): '''Configure Tkinter GUI window ...
""" Functions for easily setting up Tkinter window settings Author: Marco P. L. Ribeiro Date: June 2019 MIT License Copyright (c) 2019 Marco P. L. Ribeiro """ def configure_window(master, title='Python Application', width=600, height=600, resizable=True, centred=True, bg=None): """Configure Tkinter GUI window ...
# Copyright (c) 2016 Google Inc. (under http://www.apache.org/licenses/LICENSE-2.0) # Test trailing comma after last arg def h1(a:a1,) -> r1: pass def h2(a:a2,b:b2,) -> r2: pass def h3(a:a3) -> r3: pass def h4(a:a4) -> r4: pass
def h1(a: a1) -> r1: pass def h2(a: a2, b: b2) -> r2: pass def h3(a: a3) -> r3: pass def h4(a: a4) -> r4: pass
"""Helper structure to set default config""" # pylint: disable=line-too-long default_config = [ { "arg": "--cooldown", "type": int, "default": 1440, # A day "dest": "minutes_between_trades", "help": "It determine the amount of minutes that the trader should wait between t...
"""Helper structure to set default config""" default_config = [{'arg': '--cooldown', 'type': int, 'default': 1440, 'dest': 'minutes_between_trades', 'help': 'It determine the amount of minutes that the trader should wait between trades of the same symbol'}, {'arg': '--sleep', 'type': int, 'default': 35, 'dest': 'sleep_...
# Space: O(n) # Time: O(n) class Solution: def coinChange(self, coins, amount): dp = [amount + 1] * (amount + 1) dp[0] = 0 for i in coins: for j in range(len(dp)): if j - i >= 0: dp[j] = min(dp[j], dp[j - i] + 1) return dp[amount] if...
class Solution: def coin_change(self, coins, amount): dp = [amount + 1] * (amount + 1) dp[0] = 0 for i in coins: for j in range(len(dp)): if j - i >= 0: dp[j] = min(dp[j], dp[j - i] + 1) return dp[amount] if dp[amount] != amount + 1 el...
class coordinate: def __init__(self, x, y): self.x = x self.y = y def distance(self, other_coordinate): x_diff = (self.x - other_coordinate.x)**2 y_diff = (self.y - other_coordinate.y)**2 return (x_diff + y_diff)**0.5 if __name__ == "__main__": ...
class Coordinate: def __init__(self, x, y): self.x = x self.y = y def distance(self, other_coordinate): x_diff = (self.x - other_coordinate.x) ** 2 y_diff = (self.y - other_coordinate.y) ** 2 return (x_diff + y_diff) ** 0.5 if __name__ == '__main__': coord_1 = coord...
# Time: O(n); Space: O(n) def fib(n): memo = {} if n == 0 or n == 1: return n if n not in memo: memo[n] = fib(n - 1) + fib(n - 2) return memo[n] # Test cases: print(fib(4))
def fib(n): memo = {} if n == 0 or n == 1: return n if n not in memo: memo[n] = fib(n - 1) + fib(n - 2) return memo[n] print(fib(4))
def get_size(nbytes, suffix="B"): factor = 1024 for unit in ["", "K", "M", "G", "T", "P"]: if nbytes < factor: return f"{nbytes:.2f}{unit}{suffix}" nbytes /= factor # This shouldn't happen on real systems, but you can never be sure (2020, btw) return f"{nbytes:.2f}{unit}{suff...
def get_size(nbytes, suffix='B'): factor = 1024 for unit in ['', 'K', 'M', 'G', 'T', 'P']: if nbytes < factor: return f'{nbytes:.2f}{unit}{suffix}' nbytes /= factor return f'{nbytes:.2f}{unit}{suffix}'
class Enricher: def __init__(self, connection=None): self._connection = connection async def enrich(self, post_ids): return await self._connection.find_many(post_ids)
class Enricher: def __init__(self, connection=None): self._connection = connection async def enrich(self, post_ids): return await self._connection.find_many(post_ids)
def cycle(sequence): dict={} for i,j in enumerate(sequence): if dict.get(j, -1)<0: dict[j]=i else: return [dict[j], i] if not dict[j] else [dict[j], i-1] return []
def cycle(sequence): dict = {} for (i, j) in enumerate(sequence): if dict.get(j, -1) < 0: dict[j] = i else: return [dict[j], i] if not dict[j] else [dict[j], i - 1] return []
A = int(input()) n = 1 while n ** 3 < A: n += 1 print('YES' if n ** 3 == A else 'NO')
a = int(input()) n = 1 while n ** 3 < A: n += 1 print('YES' if n ** 3 == A else 'NO')
""" Push O(1) :Push Element To Top Pop O(1) : POP Element From Top get_max O(1) : Returns max Element from the stack Peek O(1): Returns Top Element Size O(1) : Returns Size of the stack """ class Stack: def __init__(self): self.items = [] self.itemmax=[] self.top=0 def isEmpty(self): ...
""" Push O(1) :Push Element To Top Pop O(1) : POP Element From Top get_max O(1) : Returns max Element from the stack Peek O(1): Returns Top Element Size O(1) : Returns Size of the stack """ class Stack: def __init__(self): self.items = [] self.itemmax = [] self.top = 0 def is_empty(se...
tupla =( 'APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO' ) for palavra in tupla: print('Na palavra {} temos'.format(palavra), end=' ') for letra in palavra: if letra in 'AEIOU': print('{}'.form...
tupla = ('APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO') for palavra in tupla: print('Na palavra {} temos'.format(palavra), end=' ') for letra in palavra: if letra in 'AEIOU': print('{}'.format(letra),...
# Implement a macro folly_library() that the BUILD file can load. load("@rules_cc//cc:defs.bzl", "cc_library") # Ref: https://github.com/google/glog/blob/v0.5.0/bazel/glog.bzl def expand_template_impl(ctx): ctx.actions.expand_template( template = ctx.file.template, output = ctx.outputs.out, ...
load('@rules_cc//cc:defs.bzl', 'cc_library') def expand_template_impl(ctx): ctx.actions.expand_template(template=ctx.file.template, output=ctx.outputs.out, substitutions=ctx.attr.substitutions) expand_template = rule(implementation=expand_template_impl, attrs={'template': attr.label(mandatory=True, allow_single_fi...
# Created by MechAviv # Chinese Text Damage Skin (30 Day) | (2436741) if sm.addDamageSkin(2436741): sm.chat("'Chinese Text Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
if sm.addDamageSkin(2436741): sm.chat("'Chinese Text Damage Skin (30 Day)' Damage Skin has been added to your account's damage skin collection.") sm.consumeItem()
def rumble(rate, intensity, duration): __end_regular_rumble() _["viewport"].rumble(rate, intensity, duration) def regular_rumble(rate, intensity, duration, interval): __end_regular_rumble() def _rumble(): _["viewport"].rumble(rate, intensity, duration) _["regular_rumble"] = _rumble D...
def rumble(rate, intensity, duration): __end_regular_rumble() _['viewport'].rumble(rate, intensity, duration) def regular_rumble(rate, intensity, duration, interval): __end_regular_rumble() def _rumble(): _['viewport'].rumble(rate, intensity, duration) _['regular_rumble'] = _rumble Dri...
def fuc() -> None: return None def fua() -> bool: return True def fub() -> bool: return False def fud() -> int: return -1 def fue() -> str: return ""
def fuc() -> None: return None def fua() -> bool: return True def fub() -> bool: return False def fud() -> int: return -1 def fue() -> str: return ''
del_items(0x80121A34) SetType(0x80121A34, "void PreGameOnlyTestRoutine__Fv()") del_items(0x80123AF8) SetType(0x80123AF8, "void DRLG_PlaceDoor__Fii(int x, int y)") del_items(0x80123FCC) SetType(0x80123FCC, "void DRLG_L1Shadows__Fv()") del_items(0x801243E4) SetType(0x801243E4, "int DRLG_PlaceMiniSet__FPCUciiiiiii(unsigne...
del_items(2148670004) set_type(2148670004, 'void PreGameOnlyTestRoutine__Fv()') del_items(2148678392) set_type(2148678392, 'void DRLG_PlaceDoor__Fii(int x, int y)') del_items(2148679628) set_type(2148679628, 'void DRLG_L1Shadows__Fv()') del_items(2148680676) set_type(2148680676, 'int DRLG_PlaceMiniSet__FPCUciiiiiii(uns...
# _*_ coding: utf-8 _*_ # # Package: base __all__ = ["firebase"]
__all__ = ['firebase']
class Solution(object): def mincostTickets(self, days, costs): """ :type days: List[int] :type costs: List[int] :rtype: int """ dp = [] dp.append((costs[0], days[0],)) dp.append((costs[1], days[0] + 6,)) dp.append((costs[2], days[0] + 29,)) ...
class Solution(object): def mincost_tickets(self, days, costs): """ :type days: List[int] :type costs: List[int] :rtype: int """ dp = [] dp.append((costs[0], days[0])) dp.append((costs[1], days[0] + 6)) dp.append((costs[2], days[0] + 29)) ...
class SignalGenerator: """ Signal generator class It creates different signals depending on the events it's given. Examplee of an events list: [ { "start": { "value": 10 } }, { "step": { "cycle": 100, ...
class Signalgenerator: """ Signal generator class It creates different signals depending on the events it's given. Examplee of an events list: [ { "start": { "value": 10 } }, { "step": { "cycle": 100, ...
############################################################################### # Copyright (c) 2017-2020 Koren Lev (Cisco Systems), # # Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others # # # ...
host = {'config': {'metadata_proxy_socket': '/opt/stack/data/neutron/metadata_proxy', 'nova_metadata_ip': '192.168.20.14', 'log_agent_heartbeats': False}, 'environment': 'Devstack-VPP-2', 'host': 'ubuntu0', 'host_type': ['Controller', 'Compute', 'Network'], 'id': 'ubuntu0', 'id_path': '/Devstack-VPP-2/Devstack-VPP-2-re...
@fields({"dollars": Int, "cents": Int}) class Cash: dollars = 0 cents = 0 def add_dollars(self, dollars): self.dollars += dollars def get_cash()->Cash: c = Cash() c.add_dollars(3.14159) return c get_cash()
@fields({'dollars': Int, 'cents': Int}) class Cash: dollars = 0 cents = 0 def add_dollars(self, dollars): self.dollars += dollars def get_cash() -> Cash: c = cash() c.add_dollars(3.14159) return c get_cash()
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseList(self, head): """ :type head: ListNode :rtype: ListNode """ node_list = [] if head == ...
class Solution(object): def reverse_list(self, head): """ :type head: ListNode :rtype: ListNode """ node_list = [] if head == None: return None while head: node_list.append(head) head = head.next for i in range(len(...
""" Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one. For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "bananas" is "anana". """ def longest_palindromic_substring(t...
""" Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one. For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "bananas" is "anana". """ def longest_palindromic_substring(te...
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n > k: print(x * k + (n - k) * y) else: print(x * n)
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n > k: print(x * k + (n - k) * y) else: print(x * n)
class BrawlerNotFound(Exception): """Exception raised when a Brawler can't be found from given partial name. """
class Brawlernotfound(Exception): """Exception raised when a Brawler can't be found from given partial name. """
class Player(object): def __init__(self, player_id, region_id): self.player_id = player_id self.region_id = region_id self.inventory = [] def tick(self): for item in inventory: item.tick()
class Player(object): def __init__(self, player_id, region_id): self.player_id = player_id self.region_id = region_id self.inventory = [] def tick(self): for item in inventory: item.tick()
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles)
motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) motorcycles[0] = 'ducati' print(motorcycles)
def headers(token): return { 'Authorization': f'Bearer {token}', 'content-type': 'application/json'} flight_data = { "name": "American airline"} user_data = { 'email': 'myadminss@example.com', 'username': 'myadminss', 'is_staff': True, "password":"education", }
def headers(token): return {'Authorization': f'Bearer {token}', 'content-type': 'application/json'} flight_data = {'name': 'American airline'} user_data = {'email': 'myadminss@example.com', 'username': 'myadminss', 'is_staff': True, 'password': 'education'}
""" sphinxcontrib.autohttp ~~~~~~~~~~~~~~~~~~~~~~ The sphinx.ext.autodoc-style HTTP API reference builder for sphinxcontrib.httpdomain. :copyright: Copyright 2011 by Hong Minhee :license: BSD, see LICENSE for details. """
""" sphinxcontrib.autohttp ~~~~~~~~~~~~~~~~~~~~~~ The sphinx.ext.autodoc-style HTTP API reference builder for sphinxcontrib.httpdomain. :copyright: Copyright 2011 by Hong Minhee :license: BSD, see LICENSE for details. """
# It's a BST! class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowestCommonAncestor(self, root, p, q): s, b = sorted([p.val, q.val]) while not s <= root.val <= b: root = root.left if s <= root.val el...
class Treenode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def lowest_common_ancestor(self, root, p, q): (s, b) = sorted([p.val, q.val]) while not s <= root.val <= b: root = root.left if s <= root.val else root.ri...
''' This problem was asked by Google. Given k sorted singly linked lists, write a function to merge all the lists into one sorted singly linked list. It has already been solved in: https://github.com/loghmanb/daily-coding-problem/blob/master/google_merge_k_sorted_list.py '''
""" This problem was asked by Google. Given k sorted singly linked lists, write a function to merge all the lists into one sorted singly linked list. It has already been solved in: https://github.com/loghmanb/daily-coding-problem/blob/master/google_merge_k_sorted_list.py """
# Your task is to add up letters to one letter. # The function will be given a variable amount of arguments, each one being a letter to add. # https://www.codewars.com/kata/5d50e3914861a500121e1958 # https://www.codewars.com/kata/5d50e3914861a500121e1958/solutions/python def add_letters(*letters): char_num = 0 ...
def add_letters(*letters): char_num = 0 for character in letters: char_num = char_num + ord(character) - 96 if char_num == 0 or char_num % 26 == 0: return 'z' else: return chr(char_num % 26 + 96) print(add_letters('z')) def add_letters_clever(*letters): return chr((sum((ord(...
class City: def __init__(self, name): self.name = name self.routes = {} def add_route(self, city, price_info): self.routes[city] = price_info atlanta = City("Atlanta") boston = City("Boston") chicago = City("Chicago") denver = City("Denver") el_paso = City("El Paso") atlanta.add_rout...
class City: def __init__(self, name): self.name = name self.routes = {} def add_route(self, city, price_info): self.routes[city] = price_info atlanta = city('Atlanta') boston = city('Boston') chicago = city('Chicago') denver = city('Denver') el_paso = city('El Paso') atlanta.add_route(...
def replacePi(s): if(len(s) <= 2): return s if(s[0] == "p" and s[1] == "i"): print("3.14",end='') replacePi(s[2:]) else : print(s[0],end="") replacePi(s[1:]) s = input() replacePi(s)
def replace_pi(s): if len(s) <= 2: return s if s[0] == 'p' and s[1] == 'i': print('3.14', end='') replace_pi(s[2:]) else: print(s[0], end='') replace_pi(s[1:]) s = input() replace_pi(s)
def format_sentence(sent): sent_text = sent["sent_text"] sent_start, _ = sent["sent_span"] fmt_text = str(sent_text) for mention_text, mention_start, mention_end in sorted(sent["mentions"], key=lambda x: x[1], reverse=True): mention_start, mention_end = mention_start - sent_start, mention_end - ...
def format_sentence(sent): sent_text = sent['sent_text'] (sent_start, _) = sent['sent_span'] fmt_text = str(sent_text) for (mention_text, mention_start, mention_end) in sorted(sent['mentions'], key=lambda x: x[1], reverse=True): (mention_start, mention_end) = (mention_start - sent_start, mention...
# assign table and gis_input file required column names mid_col = 'model_id' gid_col = 'gauge_id' asgn_mid_col = 'assigned_model_id' asgn_gid_col = 'assigned_gauge_id' down_mid_col = 'downstream_model_id' reason_col = 'reason' area_col = 'drain_area' order_col = 'stream_order' # name of some of the files produced by t...
mid_col = 'model_id' gid_col = 'gauge_id' asgn_mid_col = 'assigned_model_id' asgn_gid_col = 'assigned_gauge_id' down_mid_col = 'downstream_model_id' reason_col = 'reason' area_col = 'drain_area' order_col = 'stream_order' cluster_count_file = 'best-fit-cluster-count.json' cal_nc_name = 'calibrated_simulated_flow.nc' si...
__all__ = ["aobject"] class aobject(object): """ Base class for objects with an async ``__init__`` method. Creating an instance of ``aobject`` requires awaiting, e.g. ``await aobject()``. """ async def __new__(cls, *a, **kw): instance = super().__new__(cls) await instance.__init__...
__all__ = ['aobject'] class Aobject(object): """ Base class for objects with an async ``__init__`` method. Creating an instance of ``aobject`` requires awaiting, e.g. ``await aobject()``. """ async def __new__(cls, *a, **kw): instance = super().__new__(cls) await instance.__init__...
# # PySNMP MIB module SNMPv2-TC-v1 (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SNMPv2-TC-v1 # Produced by pysmi-0.3.4 at Wed May 1 11:31:22 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,...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint, constraints_union) ...
"""Constants used by pysysbot.""" VERSION = '0.3.0' AUTHOR_EMAIL = "Fabian Affolter <fabian@affolter-engineering.ch>"
"""Constants used by pysysbot.""" version = '0.3.0' author_email = 'Fabian Affolter <fabian@affolter-engineering.ch>'
n = int(input()) people = [] for i in range(n): a, b = input().split() people.append((int(a), b, i)) people.sort(key=lambda x:(x[0], x[2])) for p in people: print(p[0], p[1])
n = int(input()) people = [] for i in range(n): (a, b) = input().split() people.append((int(a), b, i)) people.sort(key=lambda x: (x[0], x[2])) for p in people: print(p[0], p[1])
#https://leetcode.com/problems/last-substring-in-lexicographical-order/discuss/369191/JavaScript-with-Explanation-no-substring-comparison-fast-O(n)-time-O(1)-space.-(Credit-to-nate17) def lastSubstring(input): start = end = 0 skip = 1 while (skip+end) < len(input): if input[start+end] == inpu...
def last_substring(input): start = end = 0 skip = 1 while skip + end < len(input): if input[start + end] == input[skip + end]: end += 1 elif input[start + end] < input[skip + end]: start = max(start + end + 1, skip) skip = start + 1 end = 0 ...
# ============================================================================= # Python examples - if else # ============================================================================= seq = [1,2,3] if len(seq) == 0: print("sequence is empty") elif len(seq) == 1: print("sequence contains one element") else...
seq = [1, 2, 3] if len(seq) == 0: print('sequence is empty') elif len(seq) == 1: print('sequence contains one element') else: print('sequence contains several elements') a = 5 b = 3 x = 10 if a > b else 1 y = a > b and 10 or 1 print(x) print(y)
class StatcordException(Exception): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class RequestFailure(StatcordException): def __init__(self, status: int, response: str): super().__init__("{}: {}".format(status, response))
class Statcordexception(Exception): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) class Requestfailure(StatcordException): def __init__(self, status: int, response: str): super().__init__('{}: {}'.format(status, response))
def get_paths(root, format='jpg', paths_count=None): path_i = 0 paths = [] for path in root.glob(f'**/*.{format}'): if path_i == paths_count: break paths.append(path) path_i += 1 return paths def get_train_val_paths(root, format='jpg', val_size=0.2, paths_count=...
def get_paths(root, format='jpg', paths_count=None): path_i = 0 paths = [] for path in root.glob(f'**/*.{format}'): if path_i == paths_count: break paths.append(path) path_i += 1 return paths def get_train_val_paths(root, format='jpg', val_size=0.2, paths_count=None)...
def a64l(s): """ An implementation of a64l as from the c stdlib. Convert between a radix-64 ASCII string and a 32-bit integer. '.' (dot) for 0, '/' for 1, '0' through '9' for [2,11], 'A' through 'Z' for [12,37], and 'a' through 'z' for [38,63]. TODO: do some implementations use '' inst...
def a64l(s): """ An implementation of a64l as from the c stdlib. Convert between a radix-64 ASCII string and a 32-bit integer. '.' (dot) for 0, '/' for 1, '0' through '9' for [2,11], 'A' through 'Z' for [12,37], and 'a' through 'z' for [38,63]. TODO: do some implementations use '' inst...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def flatten(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. ...
class Solution: def flatten(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. """ cur = root while cur: if cur.left: predecessor = cur.left next = cur.left while predecessor.right: ...
example_dict = { 65: "integer", "1": "fake integer", 3.14: "float", "3.14": "fake float", 0.345: "float 2", ".345": "fake float 2", 123.0: "float 3", "123.": " fake float 3", "false_": False, "true_": True, False: False, True: True, -3.0: "float negative", "-3.1":...
example_dict = {65: 'integer', '1': 'fake integer', 3.14: 'float', '3.14': 'fake float', 0.345: 'float 2', '.345': 'fake float 2', 123.0: 'float 3', '123.': ' fake float 3', 'false_': False, 'true_': True, False: False, True: True, -3.0: 'float negative', '-3.1': 'fake float negative', 'negative': -45, 'float_negative'...
# Things like files are called resources. They are gicen by the operating system and # have to be disposed of after being done with. # We have to close files for instance fd = open("with.py", "r") print(fd.readline()) fd.close() # In order to do this a bit more automatic you can use with with open("with.py", "r") a...
fd = open('with.py', 'r') print(fd.readline()) fd.close() with open('with.py', 'r') as f: print(f.readline())
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_180k.py', '../_base_/default_runtime.py' ] evaluation = dict(interval=20000, metric='bbox') checkpoint_config = dict(by_epoch=False, interval=20000) work_dir = 'work_dirs/coco/faster_...
_base_ = ['../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_180k.py', '../_base_/default_runtime.py'] evaluation = dict(interval=20000, metric='bbox') checkpoint_config = dict(by_epoch=False, interval=20000) work_dir = 'work_dirs/coco/faster_rcnn/faster_rcn...
class Interactions: current_os = -1 logger = None def __init__(self, current_os, logger, comfun): self.current_os = current_os self.logger = logger self.comfun = comfun def print_info(self): self.logger.raw("This is interaction with 3dsmax") # common interactions ...
class Interactions: current_os = -1 logger = None def __init__(self, current_os, logger, comfun): self.current_os = current_os self.logger = logger self.comfun = comfun def print_info(self): self.logger.raw('This is interaction with 3dsmax') def schema_item_double_...
string1 = "he's " string2 = "probably " string3 = "going to " string4 = "get fired " string5 = "today " print(string1 + string2 + string3 + string4 + string5) print("he's " "probably " "going to " "get fired " "today") print (string1 * 5) print ("he's " * 5) print ("hello " * 5 + "4") print("hello " * (5 + 4)) ...
string1 = "he's " string2 = 'probably ' string3 = 'going to ' string4 = 'get fired ' string5 = 'today ' print(string1 + string2 + string3 + string4 + string5) print("he's probably going to get fired today") print(string1 * 5) print("he's " * 5) print('hello ' * 5 + '4') print('hello ' * (5 + 4)) today = 'wednesday' pri...
def subarraySort(array): min_ascending_anomaly_number = float('inf') max_descending_anomaly_number = float('-inf') i, j = 1, len(array) - 2 while i < len(array) and j > - 1: if array[i] < array[i - 1]: min_ascending_anomaly_number = min(array[i], min_ascending_anomaly_number) ...
def subarray_sort(array): min_ascending_anomaly_number = float('inf') max_descending_anomaly_number = float('-inf') (i, j) = (1, len(array) - 2) while i < len(array) and j > -1: if array[i] < array[i - 1]: min_ascending_anomaly_number = min(array[i], min_ascending_anomaly_number) ...
# python3 def last_digit_of_the_sum_of_fibonacci_numbers_naive(n): assert 0 <= n <= 10 ** 18 if n <= 1: return n fibonacci_numbers = [0] * (n + 1) fibonacci_numbers[0] = 0 fibonacci_numbers[1] = 1 for i in range(2, n + 1): fibonacci_numbers[i] = fibonacci_numbers[i - 2] + fib...
def last_digit_of_the_sum_of_fibonacci_numbers_naive(n): assert 0 <= n <= 10 ** 18 if n <= 1: return n fibonacci_numbers = [0] * (n + 1) fibonacci_numbers[0] = 0 fibonacci_numbers[1] = 1 for i in range(2, n + 1): fibonacci_numbers[i] = fibonacci_numbers[i - 2] + fibonacci_numbers...
# File: Bridge.py # Description: Assignment 09 | Bridge # Student Name: Matthew Maxwell # Student UT EID: mrm5632 # Course Name: CS 313E # Unique Number: 50205 # Date Created: 09-30-2019 # Date Last Modified: 10-01-2019 # read file in, return data set of test cases def readFile(): myFile = open("...
def read_file(): my_file = open('bridge.txt', 'r') lines = [line.strip() for line in myFile] num_cases = int(lines[0]) lines = lines[2:] data_set = [] for i in range(numCases): data_item = [] for j in range(int(lines[0])): dataItem.append(int(lines[j + 1])) li...
# TYPE OF OPERATORS IN PYTHON # Arithmetic # Assignment # Comparison # Logical # Membership # Identity # Bitwise # Arithmetic operators: Used to perform arithmetic operations between variables # +, -, *, /, %, **, // x = 10 y = 20 # Arithmetic Operators print('Arithmetic Operators') print(x+y) print(x-y) print(x*y) pr...
x = 10 y = 20 print('Arithmetic Operators') print(x + y) print(x - y) print(x * y) print(x ** y) print(x / y) print(x // y) print(x % y) print() print('Assignment operators') x = 100 x += 10 a = 5 a += 5 print(a) a **= 5 print(a) print() print('Comparison Operators') val = 10 num1 = 20 compare = val == num1 print(compa...
# You are given a two-digit integer n. Return the sum of its digits. # Example # For n = 29, the output should be # addTwoDigits(n) = 11. def addTwoDigits(n): sum1 = 0 for i in str(n): sum1 += int(i) return sum1 print(addTwoDigits(29))
def add_two_digits(n): sum1 = 0 for i in str(n): sum1 += int(i) return sum1 print(add_two_digits(29))
# $Id: md1.py,v 1.8 2020/04/22 21:39:41 baaden Exp baaden $ # Script (c) 2020 by Marc Baaden, <baaden@smplinux.de> # # UnityMol python script to visualize the Covid-19 spike protein # activate specific commands to simplify interactive raytracing of the scene doRT = False; absolutePath = "C:/Users/ME/fair_covid_molvis...
do_rt = False absolute_path = 'C:/Users/ME/fair_covid_molvisexp/ex3_mdtraj/' in_vr = UnityMolMain.inVR() Application.runInBackground = True UnityMolMain.allowIDLE = False if doRT: bg_color('gray') UnityMolMain.disableSurfaceThread = True UnityMolMain.raytracingMode = True Screen.SetResolution(1920, 1080...
def a(x): if x == 1: print("x is 1") else: print("x is not 1")
def a(x): if x == 1: print('x is 1') else: print('x is not 1')
class Solution(object): def guessNumber(self, n: int) -> int: """ # The guess API is already defined. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num: int) -> int: """ low = 1 hi...
class Solution(object): def guess_number(self, n: int) -> int: """ # The guess API is already defined. # @param num, your guess # @return -1 if my number is lower, 1 if my number is higher, otherwise return 0 # def guess(num: int) -> int: """ low = 1 ...
def mergeSort(lst, start, end): if start < end: mid = start + (end - start) // 2 mergeSort(lst, start, mid) mergeSort(lst, mid + 1, end) merge(lst, start, end, mid) def merge(lst, start, end, mid): temp = lst[start: end + 1] left = 0 right = mid + 1 - start index = ...
def merge_sort(lst, start, end): if start < end: mid = start + (end - start) // 2 merge_sort(lst, start, mid) merge_sort(lst, mid + 1, end) merge(lst, start, end, mid) def merge(lst, start, end, mid): temp = lst[start:end + 1] left = 0 right = mid + 1 - start index =...