content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# Resize cropped image to the following shape IMG_RESIZE_SHAPE = (64, 64) # Shift camera when taking left or right image SHIFT_CAMERA = 0.25 # Extra logging VERBOSE = False # Brightness adjustment strenght BRIGHTNESS_STRENGHT = 0.2 # Crpping # Leave only 1/img_crop_param of the image IMG_CROP_PARAM = 5.5 # Crop pix...
img_resize_shape = (64, 64) shift_camera = 0.25 verbose = False brightness_strenght = 0.2 img_crop_param = 5.5 img_crop_bottom = 25 width_shift_range = 100 height_shift_range = 40 nb_epoch = 8 learning_rate = 0.0001 batch_size = 128 threshold = 0.85 prob_range = 0.08
numbers = [1, 2, 5, 7, 89, 90, 10, 20] evens = [] for n in numbers: if n % 2 == 0: evens.append(n * n) # list comprehension evens = [ n * n # add value for n in numbers # set to draw from if n % 2 == 0 # test for inclusion ] print(evens) results = [ (1, 2, 70.1), (2, 2, 80.0), ...
numbers = [1, 2, 5, 7, 89, 90, 10, 20] evens = [] for n in numbers: if n % 2 == 0: evens.append(n * n) evens = [n * n for n in numbers if n % 2 == 0] print(evens) results = [(1, 2, 70.1), (2, 2, 80.0), (4, 2, 20.0), (-4, 5, 100.0)] make_square = lambda n: n * n m = max((r[2] for r in results)) print(m) even...
class Loggable: def __init__(self): self.title = '' def log(self): print('Log message from ' + self.title) class Connection: def __init__(self): self.server = '' def connect(self): print('Connecting to data base on ' + self.server) class Sqldatabase(Connection , Loggabl...
class Loggable: def __init__(self): self.title = '' def log(self): print('Log message from ' + self.title) class Connection: def __init__(self): self.server = '' def connect(self): print('Connecting to data base on ' + self.server) class Sqldatabase(Connection, Logg...
# -*- coding: utf-8 -*- NOT_FOUND = -1 class SortedSet(object): def __init__(self): self.keys = [] self.keys_to_index = {} def get(self, key): if key in self.keys_to_index: return self.keys_to_index[key] else: return NOT_FOUND def add(self, key):...
not_found = -1 class Sortedset(object): def __init__(self): self.keys = [] self.keys_to_index = {} def get(self, key): if key in self.keys_to_index: return self.keys_to_index[key] else: return NOT_FOUND def add(self, key): try: ...
class Solution: def removeInterval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: result = [] for start, end in intervals: if start < toBeRemoved[0]: result.append([start, min(end, toBeRemoved[0])]) if toBeRemoved[1] < end: ...
class Solution: def remove_interval(self, intervals: List[List[int]], toBeRemoved: List[int]) -> List[List[int]]: result = [] for (start, end) in intervals: if start < toBeRemoved[0]: result.append([start, min(end, toBeRemoved[0])]) if toBeRemoved[1] < end: ...
""" Store all Spulsa API URL PATH here ______________________________ """ URLS = { "PRODUCTS": "/product.json", "BALANCE": "/getBalance", "TRANSACTIONS": "/transaction.json", "TRANSACTION": "/transaction/{}.json", "MOBILE_PREPAID": "/transaction/mobile.json", "MOBILE_DETAIL": "/transacti...
""" Store all Spulsa API URL PATH here ______________________________ """ urls = {'PRODUCTS': '/product.json', 'BALANCE': '/getBalance', 'TRANSACTIONS': '/transaction.json', 'TRANSACTION': '/transaction/{}.json', 'MOBILE_PREPAID': '/transaction/mobile.json', 'MOBILE_DETAIL': '/transaction/mobile/{}.json', 'INQU...
# -*- coding: utf-8 -*- """ Created on Sat Jul 11 18:21:39 2015 @author: jmalinchak """ #localoutputfolder = 'C:\Batches\AutomationProjects\Investment Strategy\ETL\Uploads\Ready' #serverwatcherdestination = '\\\\ipc-vsql01\\DATA\\Batches\\prod\\WatchFolder\\incoming' #mycachefolder = 'C:\\Batches\\GitStuff\\websites...
""" Created on Sat Jul 11 18:21:39 2015 @author: jmalinchak """ mycachefolder = 'C://Batches//GitStuff//websites//wwwroot//cache'
N,M = map(int,input().split()) A = [[] for _ in range(N)] for i in range(N): A[i].extend(map(int,input().split())) moves = [] for _ in range(M): moves.append(list(map(int,input().split()))) cloud = [[N-2,0],[N-2,1],[N-1,0],[N-1,1]] def move_cloud(cloud,direction,s,n): moved = [] dx,dy = direction[0...
(n, m) = map(int, input().split()) a = [[] for _ in range(N)] for i in range(N): A[i].extend(map(int, input().split())) moves = [] for _ in range(M): moves.append(list(map(int, input().split()))) cloud = [[N - 2, 0], [N - 2, 1], [N - 1, 0], [N - 1, 1]] def move_cloud(cloud, direction, s, n): moved = [] ...
# # PySNMP MIB module BW-ClientManagementAccessServerFault (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/BW-ClientManagementAccessServerFault # Produced by pysmi-0.3.4 at Mon Apr 29 17:25:02 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # U...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, value_size_constraint, single_value_constraint, constraints_union) ...
numbers = [] # [7, 8, 10, 13, 15, 19, 20, 23, 25] for _ in range(9): numbers.append(int(input())) summation = sum(numbers) for i in range(len(numbers)): is_hundred = False for j in range(1, (len(numbers))): if i == j: continue if summation - (numbers[i] + numbers[j]) == 100: ...
numbers = [] for _ in range(9): numbers.append(int(input())) summation = sum(numbers) for i in range(len(numbers)): is_hundred = False for j in range(1, len(numbers)): if i == j: continue if summation - (numbers[i] + numbers[j]) == 100: is_hundred = True f...
"""Kata url: https://www.codewars.com/kata/53da3dbb4a5168369a0000fe.""" def even_or_odd(number: int) -> str: return 'Odd' if number % 2 else 'Even'
"""Kata url: https://www.codewars.com/kata/53da3dbb4a5168369a0000fe.""" def even_or_odd(number: int) -> str: return 'Odd' if number % 2 else 'Even'
name=None description=None args_and_kwargs = ( (("--embed", ), { "help":"Drop to an IPython shell at the end of optimization to inpsect variables.", "action" : "store_true", "default" : False, }), (("--mc-samples",), { "help":"This is the number of samples to take per grad...
name = None description = None args_and_kwargs = ((('--embed',), {'help': 'Drop to an IPython shell at the end of optimization to inpsect variables.', 'action': 'store_true', 'default': False}), (('--mc-samples',), {'help': 'This is the number of samples to take per gradient step with default 1. ', 'type': int, 'defaul...
""" Author: Maneesh Divana <mdaneeshd77@gmail.com> Interpreter: Python 3.6.8 Count occurrences of a string that can be constructed from another given string. Given two strings str1 and str2 where str1 being the parent string. The task is to find out the number of string as str2 that can be constructed using letters o...
""" Author: Maneesh Divana <mdaneeshd77@gmail.com> Interpreter: Python 3.6.8 Count occurrences of a string that can be constructed from another given string. Given two strings str1 and str2 where str1 being the parent string. The task is to find out the number of string as str2 that can be constructed using letters o...
name1_1_1_0_1_1_0 = None name1_1_1_0_1_1_1 = None name1_1_1_0_1_1_2 = None name1_1_1_0_1_1_3 = None name1_1_1_0_1_1_4 = None
name1_1_1_0_1_1_0 = None name1_1_1_0_1_1_1 = None name1_1_1_0_1_1_2 = None name1_1_1_0_1_1_3 = None name1_1_1_0_1_1_4 = None
data = [ ['2020-05-01',20.5], ['2020-05-02',21.5], ['2020-05-03',22.5], ] dic = dict(data) print(dic) data2 = list(dic) print(data2)
data = [['2020-05-01', 20.5], ['2020-05-02', 21.5], ['2020-05-03', 22.5]] dic = dict(data) print(dic) data2 = list(dic) print(data2)
# http://rosalind.info/problems/iprb/ f = open("rosalind_iprb.txt", "r") for content in f: dominant, hetero, recessive = [float(x) for x in content.split()] total = dominant + hetero + recessive # Two recessive organisms doubleRecessive = (recessive / total) * ((recessive - 1) / (total - 1)) # Two heterozygous o...
f = open('rosalind_iprb.txt', 'r') for content in f: (dominant, hetero, recessive) = [float(x) for x in content.split()] total = dominant + hetero + recessive double_recessive = recessive / total * ((recessive - 1) / (total - 1)) double_hetero = hetero / total * ((hetero - 1) / (total - 1)) hetero_recessive = heter...
""" 677. Map Sum Pairs Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents the key and the integer represents the value. If the key already existed, then the original key-value pair will be overridden to the new one. For the ...
""" 677. Map Sum Pairs Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair of (string, integer). The string represents the key and the integer represents the value. If the key already existed, then the original key-value pair will be overridden to the new one. For the ...
# Write a program that categorizes each mail message by which day of the week the commit was # done. To do this look for lines that start with "From", then look for the third word and keep # a running count of each of the days of the week. At the end of the program print out the # contents of your dictionary (order do...
file_handle = open('/home/sunil/OpenSource/Learning/computer-science/intro-to-programming/python-for-everyone/8-files/mbox-short.txt') days_count = {} for line in file_handle: line = line.rstrip() if line.startswith('From '): day = line.split()[2] if day not in days_count.keys(): day...
def bb_intersection_over_union(box_a, box_b): """Thank you pyimagesearch! https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/ :param box_a: Rect :param box_b: Rect """ # determine the (x, y)-coordinates of the intersection rectangle xA = max(box_a[0],...
def bb_intersection_over_union(box_a, box_b): """Thank you pyimagesearch! https://www.pyimagesearch.com/2016/11/07/intersection-over-union-iou-for-object-detection/ :param box_a: Rect :param box_b: Rect """ x_a = max(box_a[0], box_b[0]) y_a = max(box_a[1], box_b[1]) x_b = min(box_a[2], ...
class Genotype: """Make string representation of cyvcf2 genotype""" def __init__(self, li): self.alleles = li[:-1] self.phased = li[-1] def __str__(self): sep = "/|"[int(self.phased)] return sep.join("0123."[a] for a in self.alleles) __repr__ = __str__ # Conversion f...
class Genotype: """Make string representation of cyvcf2 genotype""" def __init__(self, li): self.alleles = li[:-1] self.phased = li[-1] def __str__(self): sep = '/|'[int(self.phased)] return sep.join(('0123.'[a] for a in self.alleles)) __repr__ = __str__ get_score = lam...
# -*- coding: utf-8 -*- # ============================================================================= def config(settings): """ BRCMS: Sahana Beneficiary Registry and Case Management System """ # PrePopulate data settings.base.prepopulate.append("BRCMS/Standard") settings.base.prepopulat...
def config(settings): """ BRCMS: Sahana Beneficiary Registry and Case Management System """ settings.base.prepopulate.append('BRCMS/Standard') settings.base.prepopulate_demo.append('BRCMS/Standard/Demo')
#!/usr/bin/python """ Author: Radar-Lei topological sort implementation for the lecture """ class Graph: def __init__(self): self.vertex = {} # for printing the Graph vertices def print_graph(self) -> None: print(self.vertex) # for adding the edge between two vertices def ad...
""" Author: Radar-Lei topological sort implementation for the lecture """ class Graph: def __init__(self): self.vertex = {} def print_graph(self) -> None: print(self.vertex) def add_edge(self, from_vertex: str, to_vertex: str) -> None: if from_vertex in self.vertex: ...
"""Host custom exceptions.""" class DesktopAutomatorError(Exception): """Base exception.""" class UnsopportedSystemError(DesktopAutomatorError): """Unsupported system error."""
"""Host custom exceptions.""" class Desktopautomatorerror(Exception): """Base exception.""" class Unsopportedsystemerror(DesktopAutomatorError): """Unsupported system error."""
#ASCII graphic for the logo of the project def getAscii(): print("e88~~\\ ,e, d8 d8 ") print("d888 \" _d88__ _d88__ 888-~\\ /~~~8e ") print("8888 __ 888 888 888 888 88b") print("8888 | 888 888 888 888 e88~-888") prin...
def get_ascii(): print('e88~~\\ ,e, d8 d8 ') print('d888 " _d88__ _d88__ 888-~\\ /~~~8e ') print('8888 __ 888 888 888 888 88b') print('8888 | 888 888 888 888 e88~-888') print('Y888 | 888 888 888 888 C888 ...
class DiskName(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_disk_name(idx_name) class DiskNameColumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_disks()
class Diskname(object): def read_get(self, name, idx_name, unity_client): return unity_client.get_disk_name(idx_name) class Disknamecolumn(object): def get_idx(self, name, idx, unity_client): return unity_client.get_disks()
DEFAULT_BRANCH_OFFSET = 50 DEFAULT_BURN_RESERVE = 100 DEFAULT_GAS_RESERVE = 100 DEFAULT_OPERATIONS_TTL = 5 MAX_OPERATIONS_TTL = 60
default_branch_offset = 50 default_burn_reserve = 100 default_gas_reserve = 100 default_operations_ttl = 5 max_operations_ttl = 60
#test2.py if __name__=="__main__": print("this is module test2") def test2Function(): print("this is a function in module test2") if __name__=="__main__": print("this is test2 module name:"+__name__)
if __name__ == '__main__': print('this is module test2') def test2_function(): print('this is a function in module test2') if __name__ == '__main__': print('this is test2 module name:' + __name__)
#!/usr/bin/env python # Day 14 solution of Advent Of Code 2020 by Riccardo Negri # First part answer: 14954914379452 # Second part answer: 3415488160714 def replace_bit(number, bit, position): mask = 1 << position # shift return (number & ~mask) | ((bit << position) & mask) def get_sum(dictionary): sum ...
def replace_bit(number, bit, position): mask = 1 << position return number & ~mask | bit << position & mask def get_sum(dictionary): sum = 0 for key in dictionary: sum += dictionary[key] return sum with open('input.txt', 'r') as f: file = f.read().replace('=', '').replace('mem[', ' ').r...
# plotting the asset value change of the portfolio def profit(portfolio): fig = plt.figure() bx = fig.add_subplot(111) portfolio["total asset"].plot(label="Total Asset") # long/short position markers related to the portfolio # the same mechanism as the previous one # replace close price with ...
def profit(portfolio): fig = plt.figure() bx = fig.add_subplot(111) portfolio['total asset'].plot(label='Total Asset') bx.plot(portfolio['signals1'].loc[portfolio['signals1'] == 1].index, portfolio['total asset'][portfolio['signals1'] == 1], lw=0, marker='^', c='g', label='long') bx.plot(portfolio['...
__copyright__ = """\ (c). Copyright 2008-2020, Vyper Logix Corp., All Rights Reserved. Published under Creative Commons License (http://creativecommons.org/licenses/by-nc/3.0/) restricted to non-commercial educational use only., http://www.VyperLogix.com for details THE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL WARRA...
__copyright__ = '(c). Copyright 2008-2020, Vyper Logix Corp., All Rights Reserved.\n\nPublished under Creative Commons License \n(http://creativecommons.org/licenses/by-nc/3.0/) \nrestricted to non-commercial educational use only., \n\nhttp://www.VyperLogix.com for details\n\nTHE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL W...
# I'm going to use the filter method listNumber = [12, 34, 45, 6, 6, 8, 12, 79] def number_pair(num): if num % 2 == 0: return True print(list(filter(number_pair, listNumber))) # using the lambda expression listNumberTwo = [12, 34, 45, 6, 6, 8, 12, 79] print(list(filter(lambda x: x % 2 == 0, listNumberT...
list_number = [12, 34, 45, 6, 6, 8, 12, 79] def number_pair(num): if num % 2 == 0: return True print(list(filter(number_pair, listNumber))) list_number_two = [12, 34, 45, 6, 6, 8, 12, 79] print(list(filter(lambda x: x % 2 == 0, listNumberTwo))) class Employee: def __init__(self, name, position, salar...
input = """ % This would (have) trigger(ed) inferences from dynamic constraints. x | y. a :- not x. b :- not x. c :- b. a :- not c. """ output = """ % This would (have) trigger(ed) inferences from dynamic constraints. x | y. a :- not x. b :- not x. c :- b. a :- not c. """
input = '\n% This would (have) trigger(ed) inferences from dynamic constraints.\n\nx | y.\n\na :- not x.\nb :- not x.\n\nc :- b.\na :- not c.\n' output = '\n% This would (have) trigger(ed) inferences from dynamic constraints.\n\nx | y.\n\na :- not x.\nb :- not x.\n\nc :- b.\na :- not c.\n'
print("hello world") name="akanksha" middlename=("sanjay") surname=("waghmare") print(name,middlename,surname) print(name[0:9:2]) #slicing a="program" b= type (a) print(b) #type of the variable
print('hello world') name = 'akanksha' middlename = 'sanjay' surname = 'waghmare' print(name, middlename, surname) print(name[0:9:2]) a = 'program' b = type(a) print(b)
''' Created on Mar 7, 2016 @author: dj ''' class MyException(Exception): pass def method1(x, y): try: a = x / y except Exception as e: print("method1:Exception = {0}".format(e)) raise else: print("method1:No exception.") finally: print...
""" Created on Mar 7, 2016 @author: dj """ class Myexception(Exception): pass def method1(x, y): try: a = x / y except Exception as e: print('method1:Exception = {0}'.format(e)) raise else: print('method1:No exception.') finally: print('method1:Finally.') ...
def calculate_dist_in_mile(dist_km): convert_factor = 0.621371 dist_miles = convert_factor * dist_km return dist_miles
def calculate_dist_in_mile(dist_km): convert_factor = 0.621371 dist_miles = convert_factor * dist_km return dist_miles
def elapsed_time(start_time, end_time): delta_time = end_time - start_time days, seconds = divmod(delta_time.total_seconds(), 86400) hours, seconds = divmod(seconds, 3600) minutes, seconds = divmod(seconds, 60) return days, hours, int(minutes), int(seconds) def parse_time(seconds): days, secon...
def elapsed_time(start_time, end_time): delta_time = end_time - start_time (days, seconds) = divmod(delta_time.total_seconds(), 86400) (hours, seconds) = divmod(seconds, 3600) (minutes, seconds) = divmod(seconds, 60) return (days, hours, int(minutes), int(seconds)) def parse_time(seconds): (day...
lstflavors = [] def updateflavors(op, flav): if op == "add": if flav in lstflavors: print(f"{flav} already exists \n Choose a different flavor.") else: lstflavors.append(flav) print(f"{flav} added to your {lstflavors} cone!") ...
lstflavors = [] def updateflavors(op, flav): if op == 'add': if flav in lstflavors: print(f'{flav} already exists \n Choose a different flavor.') else: lstflavors.append(flav) print(f'{flav} added to your {lstflavors} cone!') print(f"That's {len(lstflavor...
""" X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone. A number is valid if each digit remains a digit after rotation. 0, 1, and 8 rotate to themselves; 2 and 5 rotate to each oth...
""" X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone. A number is valid if each digit remains a digit after rotation. 0, 1, and 8 rotate to themselves; 2 and 5 rotate to each oth...
# Expand in both directions of `low` and `high` to find maximum length palindrome def expand(s, low, high): while low >= 0 and high < len(s) and s[low] == s[high]: low = low - 1 high = high + 1 return s[low + 1:high] def longest_palindromic(s): # if there empty string if not s ...
def expand(s, low, high): while low >= 0 and high < len(s) and (s[low] == s[high]): low = low - 1 high = high + 1 return s[low + 1:high] def longest_palindromic(s): if not s or not len(s): return '' max_str = '' max_length = 0 for i in range(len(s)): curr_str = e...
"""Gunicorn config files.""" # for more directives see: # http://gunicorn-docs.readthedocs.io/en/latest/settings.html#config-file # The socket to bind. bind = '0.0.0.0:8000' # Numer of worker processes generally in the 2-4 x $(NUM_CORES) range. workers = 5 # print access/error lines to stdout accesslog = '-' errorl...
"""Gunicorn config files.""" bind = '0.0.0.0:8000' workers = 5 accesslog = '-' errorlog = '-'
FreeSansOblique24pt7bBitmaps = [ 0x01, 0xE0, 0x3C, 0x0F, 0x81, 0xE0, 0x3C, 0x07, 0x80, 0xF0, 0x3C, 0x07, 0x80, 0xF0, 0x1E, 0x03, 0xC0, 0xF0, 0x1E, 0x03, 0xC0, 0x78, 0x0F, 0x03, 0xC0, 0x78, 0x0F, 0x01, 0xE0, 0x38, 0x07, 0x00, 0xE0, 0x18, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x1E, 0x07, 0x80, 0xF0, 0...
free_sans_oblique24pt7b_bitmaps = [1, 224, 60, 15, 129, 224, 60, 7, 128, 240, 60, 7, 128, 240, 30, 3, 192, 240, 30, 3, 192, 120, 15, 3, 192, 120, 15, 1, 224, 56, 7, 0, 224, 24, 3, 0, 0, 0, 0, 0, 240, 30, 7, 128, 240, 30, 0, 120, 123, 195, 222, 31, 225, 239, 15, 120, 123, 195, 220, 28, 224, 231, 7, 48, 49, 129, 128, 0, ...
#!/usr/bin/python ''' FileName: convert_input_to_set.py Author: John Delgado Created Date: 8/7/2020 Version: 1.0 Initial Development This will take the sys.stdin input and convert it into a set and then return the set ''' def convert_input_to_set(inputVales,debug): if(not inputVales): raise Exception("In...
""" FileName: convert_input_to_set.py Author: John Delgado Created Date: 8/7/2020 Version: 1.0 Initial Development This will take the sys.stdin input and convert it into a set and then return the set """ def convert_input_to_set(inputVales, debug): if not inputVales: raise exception('Input is empty. Plea...
def monthlyexp(m): r=m m=int(input("Hostel Rent")) m1=int(input("Mobile")) m2=int(input("Food")) m3=int(input("Tea")) m4=int(input("Fish")) m5=int(input("Roti")) #print("One Day Expenses Money Total:",m+m1+m2+m3+m4+m5) a=(m*30+m1*30+m2*30+m3*30+m4*30+m5*30) print("One Month Expenses Money Total",a) def food(f): ...
def monthlyexp(m): r = m m = int(input('Hostel Rent')) m1 = int(input('Mobile')) m2 = int(input('Food')) m3 = int(input('Tea')) m4 = int(input('Fish')) m5 = int(input('Roti')) a = m * 30 + m1 * 30 + m2 * 30 + m3 * 30 + m4 * 30 + m5 * 30 print('One Month Expenses Money Total', a) def food(f): tripperson = f / n...
#!/usr/bin/python with open('passwd.txt') as fh: lines = fh.readlines() for line in lines: toks = line.split() r = toks[0] c = toks[1][:-1] p = toks[2].strip() toks2 = r.split('-') min = toks2[0] max = toks2[1] i = p.count(c) #if i < int(min) or i > int(max): # print...
with open('passwd.txt') as fh: lines = fh.readlines() for line in lines: toks = line.split() r = toks[0] c = toks[1][:-1] p = toks[2].strip() toks2 = r.split('-') min = toks2[0] max = toks2[1] i = p.count(c) cmin = p[int(min) - 1] == c cmax = p[int(max) - 1] == c if cmin ...
"""Exceptions for the confprint package. Custom exceptions used by confprint for more helpful error messages. """ class confprintException(Exception): """Base class for all confprint exceptions.""" class PropertyError(confprintException): """Selection of properties failed."""
"""Exceptions for the confprint package. Custom exceptions used by confprint for more helpful error messages. """ class Confprintexception(Exception): """Base class for all confprint exceptions.""" class Propertyerror(confprintException): """Selection of properties failed."""
with open('input.txt') as f: N, x, y = list(map(int, f.readline().split())) def lbinsearch(N, x, y, checker): left = 0 right = min(x, y) * N while left < right: middle = (left + right) // 2 if checker(N, x, y, middle): right = middle else: left = middle +...
with open('input.txt') as f: (n, x, y) = list(map(int, f.readline().split())) def lbinsearch(N, x, y, checker): left = 0 right = min(x, y) * N while left < right: middle = (left + right) // 2 if checker(N, x, y, middle): right = middle else: left = middle...
class employeeList(viewsets.ModelViewSet): def get(self,request): employees = employee.objects.all() serializer = employeeSerializer(employees,many=True) return Response(serializer.data) def post(self,request): data = request.body print(data) emp = employee() emp.firstname=data['firstname'] emp.last...
class Employeelist(viewsets.ModelViewSet): def get(self, request): employees = employee.objects.all() serializer = employee_serializer(employees, many=True) return response(serializer.data) def post(self, request): data = request.body print(data) emp = employee(...
class Person: def __init__(self, first: str, last: str, age: int): self.first = first self.last = last self.age = age @property def email(self): return f"{self.first}.{self.last}@email.com" def __str__(self): return f"{self.first}, {self.last} is {self.age} old"...
class Person: def __init__(self, first: str, last: str, age: int): self.first = first self.last = last self.age = age @property def email(self): return f'{self.first}.{self.last}@email.com' def __str__(self): return f'{self.first}, {self.last} is {self.age} old...
def register_user(r, user_id, display_name, points, rank, country): """ Stores the json fields of user data in a redis hash. Stores the country iso code of a user in a redis set Adds the user to the leaderboard using player:<guid> as the key and the points as the value. Parameters: ...
def register_user(r, user_id, display_name, points, rank, country): """ Stores the json fields of user data in a redis hash. Stores the country iso code of a user in a redis set Adds the user to the leaderboard using player:<guid> as the key and the points as the value. Parameters: ...
''' Write a program to receive the first and last name of user then print out the message "Hello, name and surname" and the alias name which derived from the first 2 characters of the first and last name. Input: receive first and last name of user. Output: display 2 lines as follows The first line shows: "Hello", you...
""" Write a program to receive the first and last name of user then print out the message "Hello, name and surname" and the alias name which derived from the first 2 characters of the first and last name. Input: receive first and last name of user. Output: display 2 lines as follows The first line shows: "Hello", your...
#!/usr/bin/env python header = """ID XXX; XXX; linear; XXX; XXX; XXX; XXX. XX AC XXX; XX DE {species}, {partial} {gene} gene for {product_DE}, cell line {cell line}, allele {allele} CC (file created with TypeLoader version {TL_version} based on {db_name} release {db_version}) XX FH Key Location/Q...
header = 'ID XXX; XXX; linear; XXX; XXX; XXX; XXX.\nXX\nAC XXX;\nXX\nDE {species}, {partial} {gene} gene for {product_DE}, cell line {cell line}, allele {allele}\nCC (file created with TypeLoader version {TL_version} based on {db_name} release {db_version})\nXX\nFH Key Location/Qualifiers\nFH\nFT ...
# Your bot's token -- Current inputted token is a dummy and is just an example token = 'NTg5NDcyMDExNjI2MjE3NDkw.XQUKnA.2tGpcPM_0S6Y0mAbW5ZukFBQQr4' # Your bot's prefix. This is what is used in front of every command. prefix = '$' # Your bot's description description = "Bot that does great things" # A list of people ...
token = 'NTg5NDcyMDExNjI2MjE3NDkw.XQUKnA.2tGpcPM_0S6Y0mAbW5ZukFBQQr4' prefix = '$' description = 'Bot that does great things' owners = [283862626520399872] embed_color = 12786762 discord_color = 3553599
__title__ = 'VSoup' __description__ = 'A Python library for automating interaction with websites' __url__ = 'https://vsoup.readthedocs.io/' __github_url__ = 'https://github.com/vaderyang/VSoup' __version__ = '1.0.0-dev' __license__ = 'MIT'
__title__ = 'VSoup' __description__ = 'A Python library for automating interaction with websites' __url__ = 'https://vsoup.readthedocs.io/' __github_url__ = 'https://github.com/vaderyang/VSoup' __version__ = '1.0.0-dev' __license__ = 'MIT'
"""Custom exceptions.""" class FlaskError(Exception): """Basic exception for this application.""" class ExperimentTypeSearchParamsMissing(FlaskError): """Raised when search params for an experiment type are not defined.""" class SearchOptionNotCustomizeable(FlaskError): """Raised when an attempt to pa...
"""Custom exceptions.""" class Flaskerror(Exception): """Basic exception for this application.""" class Experimenttypesearchparamsmissing(FlaskError): """Raised when search params for an experiment type are not defined.""" class Searchoptionnotcustomizeable(FlaskError): """Raised when an attempt to pass ...
# Haystack settings for running tests. DATABASE_ENGINE = 'sqlite3' DATABASE_NAME = 'haystack_tests.db' INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'haystack', 'core', ] ROOT_URLCONF = 'c...
database_engine = 'sqlite3' database_name = 'haystack_tests.db' installed_apps = ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'haystack', 'core'] root_urlconf = 'core.urls' haystack_siteconf = 'core.search_sites' haystack_search_engine...
def numberOfBoomerangs(self, points): return sum( n * (n - 1) for x1, y1 in points for n in collections.Counter( (x1 - x2) ** 2 + (y1 - y2) ** 2 for x2, y2 in points).values())
def number_of_boomerangs(self, points): return sum((n * (n - 1) for (x1, y1) in points for n in collections.Counter(((x1 - x2) ** 2 + (y1 - y2) ** 2 for (x2, y2) in points)).values()))
class Dog: #class attributes are common for every instance of that class species="Canis familiari" def __init__(self,name,age): #instance attributes are defined in a class and are diff for every instance of class self.name=name self.age=age #instance methods #...
class Dog: species = 'Canis familiari' def __init__(self, name, age): self.name = name self.age = age def __str__(self): return f'{self.name} is {self.age} years old' def speak(self, sound): return f'{self.name} says {sound}' class Jackrussellterrier(Dog): pass c...
# COMMON transformed_text_heading = ["transformedtokens"] input_file_sheet_name = 0 input_file_columns = ['transformedtokens'] input_file_column = 'transformedtokens' transformed_text_path_stage_4 = "../data/fluid/preprocessed-text-list-stage-4.xlsx" symptom_state_output_path = "../data/fluid/output-symptom-state.xlsx...
transformed_text_heading = ['transformedtokens'] input_file_sheet_name = 0 input_file_columns = ['transformedtokens'] input_file_column = 'transformedtokens' transformed_text_path_stage_4 = '../data/fluid/preprocessed-text-list-stage-4.xlsx' symptom_state_output_path = '../data/fluid/output-symptom-state.xlsx' maintena...
action = 'action' i = 'i' id = 'id' ip = 'ip' query = 'query' answer = 'answer' keys = 'keys' keys_replic = 'keys_replic' url = 'url' html = 'html' depth = 'depth' status = 'status' client_ip = 'client_ip' client_port = 'client_port' client_query_id = 'client_query_id' alive_req = 'alive_req' alive_rep = 'alive_rep'...
action = 'action' i = 'i' id = 'id' ip = 'ip' query = 'query' answer = 'answer' keys = 'keys' keys_replic = 'keys_replic' url = 'url' html = 'html' depth = 'depth' status = 'status' client_ip = 'client_ip' client_port = 'client_port' client_query_id = 'client_query_id' alive_req = 'alive_req' alive_rep = 'alive_rep' as...
_base_ = ['faster_rcnn_r50_fpn_32x2_1x_openimages_challenge.py'] # Use ClassAwareSampler data = dict( train_dataloader=dict(class_aware_sampler=dict(num_sample_class=1)))
_base_ = ['faster_rcnn_r50_fpn_32x2_1x_openimages_challenge.py'] data = dict(train_dataloader=dict(class_aware_sampler=dict(num_sample_class=1)))
class Output(object): def __init__(self, connection=None): self.connection = connection self.description = None self.key = None self.value = None def __repr__(self): return 'Output:"%s"="%s"' % (self.key, self.value)
class Output(object): def __init__(self, connection=None): self.connection = connection self.description = None self.key = None self.value = None def __repr__(self): return 'Output:"%s"="%s"' % (self.key, self.value)
""" LeetCode Problem 528. Random Pick with Weight Link: https://leetcode.com/problems/random-pick-with-weight/ Written by: Mostofa Adib Shakib Language: Python Example: Array = [1, 9] When we pick up a at random number out of it, the chance is that 9 times out of 10 we would pick the number 9. In other words, the ...
""" LeetCode Problem 528. Random Pick with Weight Link: https://leetcode.com/problems/random-pick-with-weight/ Written by: Mostofa Adib Shakib Language: Python Example: Array = [1, 9] When we pick up a at random number out of it, the chance is that 9 times out of 10 we would pick the number 9. In other words, the ...
# Copyright 2020 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
def strip_shacl_prefix(url: str) -> str: """Strip the shacl prefix and return value of the url. Args: url (str): String with shacl prefix. Returns: str: String after removing shacl prefix.. """ term = str(url) return term[27:] def strip_url(url: str) -> str: """Strip the u...
{ "name" : "Facturacion", "version" : "1.0", "depends" :[ "base", "account", "sale", "account_voucher", "fiscaloriginal", ], "author" : "Odoo ERP", "description" : """ Modulo de ventas ...
{'name': 'Facturacion', 'version': '1.0', 'depends': ['base', 'account', 'sale', 'account_voucher', 'fiscaloriginal'], 'author': 'Odoo ERP', 'description': '\n Modulo de ventas\n ', 'website': 'http://none.com', 'category': 'Account', 'init_xml': [], 'demo_xml': [], 'update_xml': ['report/factura_...
def main(request, response): body = request.GET.first(b"body", None) type = request.GET.first(b"type", None) response.add_required_headers = False response.writer.write_status(200) response.writer.write_header(b"content-length", len(body)) response.writer.write_header(b"content-type", type) ...
def main(request, response): body = request.GET.first(b'body', None) type = request.GET.first(b'type', None) response.add_required_headers = False response.writer.write_status(200) response.writer.write_header(b'content-length', len(body)) response.writer.write_header(b'content-type', type) ...
n = int(input()) def get_common(num): if num == 1: return sum([1]) return sum([i for i in range(1, int(num/2)+1) if num % i == 0] + [num]) cashe = {} def cal(num): for i in range(1, num+1): temp = cashe.get(i, None) if temp is None: temp = get_common(i) if not ...
n = int(input()) def get_common(num): if num == 1: return sum([1]) return sum([i for i in range(1, int(num / 2) + 1) if num % i == 0] + [num]) cashe = {} def cal(num): for i in range(1, num + 1): temp = cashe.get(i, None) if temp is None: temp = get_common(i) if...
def two_sum(nums, target): my_dict = {} for i in range(len(nums)): if target - nums[i] in my_dict: return [ my_dict[ target - nums[i]], i] else: my_dict[nums[i]] = i return target.values() if __name__ == '__main__': nums = [2, 7, 11, 15] target = 9 prin...
def two_sum(nums, target): my_dict = {} for i in range(len(nums)): if target - nums[i] in my_dict: return [my_dict[target - nums[i]], i] else: my_dict[nums[i]] = i return target.values() if __name__ == '__main__': nums = [2, 7, 11, 15] target = 9 print(two...
""" What is to dream? A dance of retracing and detracing the steps taken while awake (the life). """ class Dream: def __init__(self, life_events): self.life_events = life_events self.day_events = life_events.current_day pass def retracing(self): # retake the self.step pa...
""" What is to dream? A dance of retracing and detracing the steps taken while awake (the life). """ class Dream: def __init__(self, life_events): self.life_events = life_events self.day_events = life_events.current_day pass def retracing(self): pass def detracing(self): ...
# # PySNMP MIB module UPS2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/UPS2-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:44:24 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:1...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ...
# Copyright 2021 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
"""xcframework Starlark tests.""" load(':rules/common_verification_tests.bzl', 'archive_contents_test') def apple_static_xcframework_test_suite(name): """Test suite for apple_static_xcframework. Args: name: the base name to be used in things created by this macro """ archive_contents_test(name='...
# Copyright (C) 2012 Victor Semionov # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, this # list of conditions and ...
app_name = 'NPAmp' gui_app_name = 'G' + app_name app_version = '1.2.18' app_author_name = 'Victor Semionov' app_author_email = 'vsemionov@gmail.com' app_author = '%s <%s>' % (app_author_name, app_author_email) app_url = 'http://www.vsemionov.org/npamp/' app_description = 'Numerical model of a laser amplifier for pulse ...
class HydroShareException(Exception): def __init__(self, args): super(HydroShareException, self).__init__(args) class HydroShareArgumentException(HydroShareException): def __init__(self, args): super(HydroShareArgumentException, self).__init__(args) class HydroShareBagNotReadyExcep...
class Hydroshareexception(Exception): def __init__(self, args): super(HydroShareException, self).__init__(args) class Hydroshareargumentexception(HydroShareException): def __init__(self, args): super(HydroShareArgumentException, self).__init__(args) class Hydrosharebagnotreadyexception(Hydro...
# Link : https://leetcode.com/problems/backspace-string-compare/ # Stack approach # Iterate through the string and push elements in a stack after checking if the element is a "#" # If the element is a "#" , pop the top ele of the stack # If not , simply push the ele into the stack # Convert the stack into a string ...
class Solution(object): def backspace_compare(self, s, t): """ :type s: str :type t: str :rtype: bool """ def build(S): stack = [] for i in S: if i != '#': stack.append(i) elif stack: ...
# https://leetcode.com/problems/trapping-rain-water/ # https://practice.geeksforgeeks.org/problems/trapping-rain-water-1587115621/1# # For More solutions: https://www.geeksforgeeks.org/trapping-rain-water/ class Solution: def trap(self, arr: List[int]) -> int: n = len(arr) if n==0...
class Solution: def trap(self, arr: List[int]) -> int: n = len(arr) if n == 0: return 0 left = [0] * n right = [0] * n water = 0 left[0] = arr[0] for i in range(1, n): left[i] = max(left[i - 1], arr[i]) right[n - 1] = arr[n - 1...
class Solution: def shift(self, nums1, j, final_len): for i in range(final_len, j, -1): nums1[i] = nums1[i - 1] def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do no...
class Solution: def shift(self, nums1, j, final_len): for i in range(final_len, j, -1): nums1[i] = nums1[i - 1] def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: void Do n...
''' This code snippet is to explain how a binary tree is constructed, and one of its implementations in Python3. We will discussing the basic structure and properties of the binary tree. A Binary tree is made up of "Nodes". Each node is connected to atmost two other nodes. We typically draw these two "child" nodes at ...
""" This code snippet is to explain how a binary tree is constructed, and one of its implementations in Python3. We will discussing the basic structure and properties of the binary tree. A Binary tree is made up of "Nodes". Each node is connected to atmost two other nodes. We typically draw these two "child" nodes at ...
# python3 n = int(input()) a = [int(i) for i in input().split()] m = int(input()) b = [int(i) for i in input().split()] dp = [[0 for j in range(m+1)] for i in range(n+1)] for i in range(1, n+1): for j in range(1, m+1): if a[i-1] == b[j-1]: dp[i][j] = dp[i-1][j-1] + 1 else: ...
n = int(input()) a = [int(i) for i in input().split()] m = int(input()) b = [int(i) for i in input().split()] dp = [[0 for j in range(m + 1)] for i in range(n + 1)] for i in range(1, n + 1): for j in range(1, m + 1): if a[i - 1] == b[j - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: ...
def __after_init_updatehub_atmel(): PLATFORM_ROOT_DIR = os.environ['PLATFORM_ROOT_DIR'] append_layers([ os.path.join(PLATFORM_ROOT_DIR, 'sources', p) for p in [ 'meta-atmel', 'meta-updatehub-atmel', ]]) run_after_init(__af...
def __after_init_updatehub_atmel(): platform_root_dir = os.environ['PLATFORM_ROOT_DIR'] append_layers([os.path.join(PLATFORM_ROOT_DIR, 'sources', p) for p in ['meta-atmel', 'meta-updatehub-atmel']]) run_after_init(__after_init_updatehub_atmel)
budget: float = float(input()) * .9 extras: int = int(input()) extras_costume_price: float = float(input()) extras_costume_expense = (extras * extras_costume_price) * .9 if extras > 150 else extras * extras_costume_price leftover = round(budget - extras_costume_expense, 2) if leftover < 0: print('Not enough money...
budget: float = float(input()) * 0.9 extras: int = int(input()) extras_costume_price: float = float(input()) extras_costume_expense = extras * extras_costume_price * 0.9 if extras > 150 else extras * extras_costume_price leftover = round(budget - extras_costume_expense, 2) if leftover < 0: print('Not enough money!\...
""" Description: model-dependent wiring and behavior """ # copy and paste definitions for your model at the bottom of this file # model 0000 (my prototype) BTN_R = 6 BTN_L = 5 ACTIVE_HIGH = 0 LCD_RS = 24 LCD_EN = 25 LCD_D4 = 8 LCD_D5 = 7 LCD_D6 = 12 LCD_D7 = 16 # models 0001-0009 (v2 wiring) # LCD pins on exterior e...
""" Description: model-dependent wiring and behavior """ btn_r = 6 btn_l = 5 active_high = 0 lcd_rs = 24 lcd_en = 25 lcd_d4 = 8 lcd_d5 = 7 lcd_d6 = 12 lcd_d7 = 16 btn_r = 22 btn_l = 27 active_high = 1 lcd_rs = 15 lcd_en = 23 lcd_d4 = 24 lcd_d5 = 25 lcd_d6 = 8 lcd_d7 = 7 cols = 16 rows = 2 btn_r = 3 btn_l = 2 active_hig...
class Validator: @staticmethod def raise_if_string_is_empty_or_whitespace(string, error_message): if string.strip() == "": raise ValueError(error_message) @staticmethod def raise_if_value_equal_or_less_than_zero(value, error_message): if value <= 0: raise ValueEr...
class Validator: @staticmethod def raise_if_string_is_empty_or_whitespace(string, error_message): if string.strip() == '': raise value_error(error_message) @staticmethod def raise_if_value_equal_or_less_than_zero(value, error_message): if value <= 0: raise value...
# Write Python class to perform addition of two complex numbers using binary + operator overloading. class Complex: def __init__(self, real, imaginary): self.real = real self.imaginary = imaginary def __add__(self, other): return Complex(self.real + other.real, self.imaginary + other.i...
class Complex: def __init__(self, real, imaginary): self.real = real self.imaginary = imaginary def __add__(self, other): return complex(self.real + other.real, self.imaginary + other.imaginary) def __str__(self): return str(self.real) + ' + ' + str(self.imaginary) + 'i' c...
class Charter: TRACK_NAMES = [ 'ExpertSingle', 'ExpertDoubleBass', 'ExpertDoubleRhythm', 'ExpertDoubleGuitar', 'ExpertKeyboard', 'HardSingle', 'HardDoubleBass', 'HardDoubleRhythm', 'HardDoubleGuitar', 'HardKeyboard', 'MediumSing...
class Charter: track_names = ['ExpertSingle', 'ExpertDoubleBass', 'ExpertDoubleRhythm', 'ExpertDoubleGuitar', 'ExpertKeyboard', 'HardSingle', 'HardDoubleBass', 'HardDoubleRhythm', 'HardDoubleGuitar', 'HardKeyboard', 'MediumSingle', 'MediumDoubleBass', 'MediumDoubleRhythm', 'MediumDoubleGuitar', 'MediumKeyboard', 'E...
# Lexer that produces a sequence of tokens (keywords + ANY). class Token: def __init__(self, type, word_index=-1, extra=''): self.type = type self.extra = extra self.word_index = word_index self.done = False def __eq__(self, o): return self.type == o def __repr__(s...
class Token: def __init__(self, type, word_index=-1, extra=''): self.type = type self.extra = extra self.word_index = word_index self.done = False def __eq__(self, o): return self.type == o def __repr__(self): return str(self.type) def scan(line, keywords)...
# Use "e" to convert a number into scientific number format (with a lower-case e): txt = "We have {:e} chickens." print(txt.format(5))
txt = 'We have {:e} chickens.' print(txt.format(5))
class ReportBuilder: def __init__(self, filename): self.filename = filename def buildReport(self, data): print('Calling buildReport from ReportBuilder.') print('Filename is: {}'.format(self.filename)) raise NotImplementedError()
class Reportbuilder: def __init__(self, filename): self.filename = filename def build_report(self, data): print('Calling buildReport from ReportBuilder.') print('Filename is: {}'.format(self.filename)) raise not_implemented_error()
def solution(ranks): n = 0 m = 0 r = 0 s = sorted(ranks) print(s) for i in range(len(s)-1): d = s[i+1] - s[i] if d == 0: if i != (len(s)-2): n += 1 elif d == 1: m += 1 else: n = 0 r = n + m print(r) solut...
def solution(ranks): n = 0 m = 0 r = 0 s = sorted(ranks) print(s) for i in range(len(s) - 1): d = s[i + 1] - s[i] if d == 0: if i != len(s) - 2: n += 1 elif d == 1: m += 1 else: n = 0 r = n + m print(r) s...
token_query = ''' SELECT T.token, count(*) as C FROM "TokenLinks" TL JOIN "Token" T ON T.tokenid = TL.target WHERE TL.source = (SELECT tokenid FROM "Token" T WHERE T.token = :token) AND TL.distance > -4 AND TL.distance < 28 and T.dateid=:id GROUP BY T.token HAVING coun...
token_query = '\n SELECT \n T.token, \n count(*) as C\n\n FROM "TokenLinks" TL JOIN "Token" T\n ON T.tokenid = TL.target\n\n WHERE TL.source = \n (SELECT tokenid FROM "Token" T WHERE T.token = :token)\n AND TL.distance > -4 AND TL.distance < 28 and T.dateid=:id\n\n GROUP BY T.token HA...
def e_crescente(a, b, c, cond=True, condd=True, conddd=True): if cond: return c, b, a elif condd: return b, c, a elif conddd: return a, b, c elif a == b > c: return c, a, b elif a == c > b: return b, a, c elif b == c > a: return a, b, c elif c ...
def e_crescente(a, b, c, cond=True, condd=True, conddd=True): if cond: return (c, b, a) elif condd: return (b, c, a) elif conddd: return (a, b, c) elif a == b > c: return (c, a, b) elif a == c > b: return (b, a, c) elif b == c > a: return (a, b, c)...
###### FlightPort scripts ##### def BuildFlightPortPanel(UserPanel, FlightPortInfo, UnitInfo): # UnitInfo.DisplayMessage('BuildFlightPortPanelCalled') UserPanel.Clear() UserPanel.SetTitle('Flight Deck Control') # draw buttons for heading row UserPanel.AddItem('Unit Type','',10,10,80,12) UserPa...
def build_flight_port_panel(UserPanel, FlightPortInfo, UnitInfo): UserPanel.Clear() UserPanel.SetTitle('Flight Deck Control') UserPanel.AddItem('Unit Type', '', 10, 10, 80, 12) UserPanel.BoldLastItem() UserPanel.AddItem('Location', '', 90, 10, 50, 12) UserPanel.BoldLastItem() UserPanel.AddIt...
class LanguageDictionary: """Add padding to sentences, add <START> and <END> token to target sentence and convert each token to the index of the corresponding vocabulary. Args: source_sentences (array of array of str): Tokenized sentences in English. target_sentences (array of array of str): T...
class Languagedictionary: """Add padding to sentences, add <START> and <END> token to target sentence and convert each token to the index of the corresponding vocabulary. Args: source_sentences (array of array of str): Tokenized sentences in English. target_sentences (array of array of str): To...
# # @lc app=leetcode id=34 lang=python3 # # [34] Find First and Last Position of Element in Sorted Array # # @lc code=start class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: l, r = 0, len(nums) - 1 l_index = r_index = -1 while l <= r: if nums[l...
class Solution: def search_range(self, nums: List[int], target: int) -> List[int]: (l, r) = (0, len(nums) - 1) l_index = r_index = -1 while l <= r: if nums[l] == target: l_index = l else: l += 1 if nums[r] == target: ...
#Make a copy of this file, and enter your information into the dictionary fields. Name the file 'secret.json'. #For the ID's in disocrd, make sure your values are ints, not strings. jsonfo = {"TOKEN": "YOUR BOT TOKEN", "red_id":"REDDIT CLIENT ID", "red_secret": "REDDIT CLIENT SECRET", "red_usr_agent": "REDDIT USER AGEN...
jsonfo = {'TOKEN': 'YOUR BOT TOKEN', 'red_id': 'REDDIT CLIENT ID', 'red_secret': 'REDDIT CLIENT SECRET', 'red_usr_agent': 'REDDIT USER AGENT', 'bot_email': 'BOT EMAIL', 'bot_email_pass': 'PASSWORD FOR BOT EMAIL', 'code_help_id': 'ID FOR THE CODE HELP/ CODE MENTORING CHANNEL', 'home_channel_id': 'ID FOR THE HOME CHANNEL...
class personaje(): def __init__(self, FechaDeCreacion, EpisodiosDondeAparece, NumeroEpisodiosDondeAparece, Genero, Id_Personaje, Imagen, Location_Name, Location_URL, Nombre, Origen_Name, Origen_URL, Especie, Status, Tipo, URL): self._FechaDeCreacion = FechaDeCreacion self._EpisodiosDondeAparece = E...
class Personaje: def __init__(self, FechaDeCreacion, EpisodiosDondeAparece, NumeroEpisodiosDondeAparece, Genero, Id_Personaje, Imagen, Location_Name, Location_URL, Nombre, Origen_Name, Origen_URL, Especie, Status, Tipo, URL): self._FechaDeCreacion = FechaDeCreacion self._EpisodiosDondeAparece = Epi...
#!/usr/bin/env python3 def sum_exists(ls, target): seen = set() for n in ls: if target - n in seen: return True seen.add(n) return False with open('input.txt', 'r') as infile: numbers = [int(n) for n in infile] for i in range(25, len(numbers)): if not sum_exists(numbe...
def sum_exists(ls, target): seen = set() for n in ls: if target - n in seen: return True seen.add(n) return False with open('input.txt', 'r') as infile: numbers = [int(n) for n in infile] for i in range(25, len(numbers)): if not sum_exists(numbers[i - 25:i], numbers[i]): ...
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://root: @127.0.0.1:3306/mbti" SECRET_KEY = "iljxlijO*JCl:Idjlisjf8zj8*E" ALGORITHM = "HS256" ACCESS_TOKEN_EXPIRE_MINUTES = 30
sqlalchemy_database_url = 'mysql+pymysql://root: @127.0.0.1:3306/mbti' secret_key = 'iljxlijO*JCl:Idjlisjf8zj8*E' algorithm = 'HS256' access_token_expire_minutes = 30
def maiusculas(frase): cont = len(frase) - 1 i = 0 frase_m = "" while i <= cont: if ord(frase[i]) < 91 and ord(frase[i]) > 64: frase_m += frase[i] i += 1 return frase_m
def maiusculas(frase): cont = len(frase) - 1 i = 0 frase_m = '' while i <= cont: if ord(frase[i]) < 91 and ord(frase[i]) > 64: frase_m += frase[i] i += 1 return frase_m
# Approach 1 def reverseString1(inpStr: str) -> str: optStr = inpStr[::-1] return optStr # Approach 2 def reverseString2(inpStr: str) -> str: optStr = "" for ele in inpStr: optStr = ele + optStr return optStr print(reverseString1("krupesh")) print(reverseString2("krupesh"))
def reverse_string1(inpStr: str) -> str: opt_str = inpStr[::-1] return optStr def reverse_string2(inpStr: str) -> str: opt_str = '' for ele in inpStr: opt_str = ele + optStr return optStr print(reverse_string1('krupesh')) print(reverse_string2('krupesh'))
"""Version details for ovrlib""" __title__ = "ovrlib" __description__ = "Library to interface with per-state online voter registration APIs" __url__ = "https://github.com/vote/state-registration-apis" __version__ = "0.0.6" __author__ = "Sage Weil" __author_email__ = "sage@newdream.net" __license__ = "Apache 2.0" __mai...
"""Version details for ovrlib""" __title__ = 'ovrlib' __description__ = 'Library to interface with per-state online voter registration APIs' __url__ = 'https://github.com/vote/state-registration-apis' __version__ = '0.0.6' __author__ = 'Sage Weil' __author_email__ = 'sage@newdream.net' __license__ = 'Apache 2.0' __main...
for i in range(int(input())): n = int(input()) for j in range(n): a = [int(k) for k in input().split()] print(sum(a[1:len(a)//2+1]))
for i in range(int(input())): n = int(input()) for j in range(n): a = [int(k) for k in input().split()] print(sum(a[1:len(a) // 2 + 1]))