content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
class VarDecl: def __init__(self, name: str, type: str): self._name = name self._type = type def name(self) -> str: return self._name def type(self) -> str: return self._type
class Vardecl: def __init__(self, name: str, type: str): self._name = name self._type = type def name(self) -> str: return self._name def type(self) -> str: return self._type
# Exercise 01.2 # Author: Leonardo Ferreira Santos arguments = input('Say something: ') print('Number of characters: ', arguments.__sizeof__() - 25) # "-25" is necessary because this function always implements "25". print('Reversed: ', arguments[::-1])
arguments = input('Say something: ') print('Number of characters: ', arguments.__sizeof__() - 25) print('Reversed: ', arguments[::-1])
class Matrix: def __init__(self, *rows): self.matrix = [row for row in rows] def __repr__(self): matrix_repr = "" for i, row in enumerate(self.matrix): row_repr = " ".join(f"{n:6.2f}" for n in row[:-1]) row_repr = f"{i}: {row_repr} | {row[-1]:6.2f}" ...
class Matrix: def __init__(self, *rows): self.matrix = [row for row in rows] def __repr__(self): matrix_repr = '' for (i, row) in enumerate(self.matrix): row_repr = ' '.join((f'{n:6.2f}' for n in row[:-1])) row_repr = f'{i}: {row_repr} | {row[-1]:6.2f}' ...
# C++ | General multiple_files = True no_spaces = False type_name = "Pixel" # C++ | Names name_camelCase = True name_lower = False # Other out_filename = "Out.cpp" # Only works when multiple_files is on multiple_files_extension = ".h"
multiple_files = True no_spaces = False type_name = 'Pixel' name_camel_case = True name_lower = False out_filename = 'Out.cpp' multiple_files_extension = '.h'
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_content(pluginname, "shopex")
def run(whatweb, pluginname): whatweb.recog_from_content(pluginname, 'shopex')
# # PySNMP MIB module CISCO-UNIFIED-COMPUTING-DOMAIN-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-DOMAIN-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:15:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using...
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, constraints_intersection, value_range_constraint, constraints_union, single_value_constraint) ...
def test_e1(): a: list[i32] a = [1, 2, 3] b: list[str] b = ['1', '2'] a = b
def test_e1(): a: list[i32] a = [1, 2, 3] b: list[str] b = ['1', '2'] a = b
reslist = [ -3251, -1625, 0, 1625, 3251, 4876, 6502, 8127, 9752, 11378, 13003, ] # 1625/1626 increments def fromcomp(val, bits): if val >> (bits - 1) == 1: return 0 - (val ^ (2 ** bits - 1)) - 1 else: return val filepath = "out.log" with open(fil...
reslist = [-3251, -1625, 0, 1625, 3251, 4876, 6502, 8127, 9752, 11378, 13003] def fromcomp(val, bits): if val >> bits - 1 == 1: return 0 - (val ^ 2 ** bits - 1) - 1 else: return val filepath = 'out.log' with open(filepath) as fp: line = fp.readline() while line: if line[32:34] =...
# fun from StackOverflow :) def toFixed(numObj, digits=0): return f"{numObj:.{digits}f}" # init a = int(input("Enter a> ")) b = int(input("Enter b> ")) c = int(input("Enter c> ")) d = int(input("Enter d> ")) # calc f = toFixed((a+b) / (c+d), 2) # output print("(a + b) / (c + d) = ", f)
def to_fixed(numObj, digits=0): return f'{numObj:.{digits}f}' a = int(input('Enter a> ')) b = int(input('Enter b> ')) c = int(input('Enter c> ')) d = int(input('Enter d> ')) f = to_fixed((a + b) / (c + d), 2) print('(a + b) / (c + d) = ', f)
#20 se 100 takk vo print kro jo 2 se devied ho num=20 while num<=100: a=num-20 if num%2==0: print(num) num+=1
num = 20 while num <= 100: a = num - 20 if num % 2 == 0: print(num) num += 1
{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "HW5_FFT.py", "provenance": [], "collapsed_sections": [], "authorship_tag": "ABX9TyOW+hfid580c7DvA724SrbG", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": ...
{'nbformat': 4, 'nbformat_minor': 0, 'metadata': {'colab': {'name': 'HW5_FFT.py', 'provenance': [], 'collapsed_sections': [], 'authorship_tag': 'ABX9TyOW+hfid580c7DvA724SrbG', 'include_colab_link': true}, 'kernelspec': {'name': 'python3', 'display_name': 'Python 3'}}, 'cells': [{'cell_type': 'markdown', 'metadata': {'i...
def area_of_rectangle(a,b): return a * b a = int(input()) b = int(input()) print(area_of_rectangle(a,b))
def area_of_rectangle(a, b): return a * b a = int(input()) b = int(input()) print(area_of_rectangle(a, b))
t = int(input()) for _ in range(t): a, b = map(int, input().split()) diff = abs(b-a) if diff == 0: print(0) continue if diff % 10 == 0: print(diff//10) else: print(diff//10 + 1)
t = int(input()) for _ in range(t): (a, b) = map(int, input().split()) diff = abs(b - a) if diff == 0: print(0) continue if diff % 10 == 0: print(diff // 10) else: print(diff // 10 + 1)
def sortMolKeys(my_molecules): if ' and ' not in list(my_molecules.keys())[0]: my_sort = ['' for i in range(len(my_molecules))] nums = [int(i.split()[0]) for i in my_molecules] nums_sorted = ['%i'%i for i in sorted(nums)] for key in my_molecules: index = nums_sorted.index...
def sort_mol_keys(my_molecules): if ' and ' not in list(my_molecules.keys())[0]: my_sort = ['' for i in range(len(my_molecules))] nums = [int(i.split()[0]) for i in my_molecules] nums_sorted = ['%i' % i for i in sorted(nums)] for key in my_molecules: index = nums_sorted.i...
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ # No difference between single and double quotes x = ''' seven '''.capitalize() print('x is {}'.format(x)) print(type(x))
x = ' \n\nseven\n\n'.capitalize() print('x is {}'.format(x)) print(type(x))
x = int(input()) y = int(input()) # the variables `x` and `y` are defined, so just print their sum print(sum([x, y]))
x = int(input()) y = int(input()) print(sum([x, y]))
hash_table = [0] * 8 def get_key(data): return hash(data) def get_address(key): return key % 8 def save_data(data, value): key = get_key(data) addr = get_address(key) if not hash_table[addr]: hash_table[addr] = [[key, value]] else: for i in range(len(hash_table[addr])): ...
hash_table = [0] * 8 def get_key(data): return hash(data) def get_address(key): return key % 8 def save_data(data, value): key = get_key(data) addr = get_address(key) if not hash_table[addr]: hash_table[addr] = [[key, value]] else: for i in range(len(hash_table[addr])): ...
set_name(0x8012427C, "PresOnlyTestRoutine__Fv", SN_NOWARN) set_name(0x801242A4, "FeInitBuffer__Fv", SN_NOWARN) set_name(0x801242CC, "FeAddEntry__Fii8TXT_JUSTiP7FeTableP5CFont", SN_NOWARN) set_name(0x8012433C, "FeAddTable__FP11FeMenuTablei", SN_NOWARN) set_name(0x801243BC, "FeDrawBuffer__Fv", SN_NOWARN) set_name(0x80124...
set_name(2148680316, 'PresOnlyTestRoutine__Fv', SN_NOWARN) set_name(2148680356, 'FeInitBuffer__Fv', SN_NOWARN) set_name(2148680396, 'FeAddEntry__Fii8TXT_JUSTiP7FeTableP5CFont', SN_NOWARN) set_name(2148680508, 'FeAddTable__FP11FeMenuTablei', SN_NOWARN) set_name(2148680636, 'FeDrawBuffer__Fv', SN_NOWARN) set_name(2148681...
src='2018-5540' region='box[[181pix,79pix], [681pix,816pix]]' directory='/Volumes/NARNIA/pilot_cutouts/leakage_corrected/2018-5540/' imsubimage(imagename='FDF_peakRM_fitted_corrected.fits',outfile='pkrm_smol_temp',region=region,overwrite=True,dropdeg=True) exportfits(imagename='pkrm_smol_temp',fitsimage='2018-5540_p...
src = '2018-5540' region = 'box[[181pix,79pix], [681pix,816pix]]' directory = '/Volumes/NARNIA/pilot_cutouts/leakage_corrected/2018-5540/' imsubimage(imagename='FDF_peakRM_fitted_corrected.fits', outfile='pkrm_smol_temp', region=region, overwrite=True, dropdeg=True) exportfits(imagename='pkrm_smol_temp', fitsimage='201...
# coding=utf-8 BASE_ENDPOINT = "http://sskj.si/?s={}" MAX_DEFINITIONS = 50 MAX_CACHE_AGE = 43200 class SpecialChars: TERMINOLOGY = u"\u25CF" SLANG = u"\u2666" REPLACEMENTS = { # no-break space replacement with normal space "\xa0": " " } def remove_num(d): for n in range(1, MAX_DEFINITIONS): ...
base_endpoint = 'http://sskj.si/?s={}' max_definitions = 50 max_cache_age = 43200 class Specialchars: terminology = u'●' slang = u'♦' replacements = {'\xa0': ' '} def remove_num(d): for n in range(1, MAX_DEFINITIONS): if str(d).startswith(str(n) + '.'): return str(d).strip(str(n) + '.'...
#### Regulation Z IGNORE_DEFINITIONS_IN_PART_1026 = [ 'credit report', 'credit-report', 'Consumer Price Index', 'credit counseling', 'and credit the', 'credit reporting agencies', 'credit history', 'Credit the amount', 'credit to a deposit account', 'Consumer Price level', '...
ignore_definitions_in_part_1026 = ['credit report', 'credit-report', 'Consumer Price Index', 'credit counseling', 'and credit the', 'credit reporting agencies', 'credit history', 'Credit the amount', 'credit to a deposit account', 'Consumer Price level', 'may state', 'and state that', 'could state', 'must state', 'shal...
class Solution: def bitwiseComplement(self, N: int) -> int: X = 1 while N > X: X = X * 2 + 1 return X - N
class Solution: def bitwise_complement(self, N: int) -> int: x = 1 while N > X: x = X * 2 + 1 return X - N
class Constants: HEADERS = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) ' 'Gecko/20100101 Firefox/70.0' } HEADERS = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) ' 'Gecko/20100101 Firefox/70.0', "Connection": ...
class Constants: headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0'} headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0', 'Connection': 'close'}
# You are developing an online booking portal for a bus tour company. On the website, tourists can book in # groups to come on your company's city bus tour. The company has various buses with different capacities. # You want to determine, from the list of available bookings, if you can completely fill up a particular b...
class Fullbustour: def __init__(self, group_sizes, full_cap): self.group_sizes = group_sizes self.full_cap = full_cap def fits_exactly(self): return False
# # PySNMP MIB module SIEMENS-HP4KHIM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIEMENS-HP4KHIM-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:04:13 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, value_size_constraint, single_value_constraint, value_range_constraint, constraints_intersection) ...
''' /profissional-de-saude/{idprofissional}/gerar-consulta/{dateTime}{ blueprint:paciente template:profissionalDesSaudeGerarConsulta.html dados:{ consulta{ nomeProfissional, especialidade, dateTime, valor } } *******pagseguro } '''
""" /profissional-de-saude/{idprofissional}/gerar-consulta/{dateTime}{ blueprint:paciente template:profissionalDesSaudeGerarConsulta.html dados:{ consulta{ nomeProfissional, especialidade, dateTime, valor } } *******pagseguro } """
# https://easily-champion-frog.dataos.io:7432/depot/collection connection_regex = r"^(http|https):\/\/([\w.-]+(?:\:\d+)?(?:,[\w.-]+(?:\:\d+)?)*)(\/\w+)?(\/\w+)?(\?[\w.-]+=[\w.-]+(?:&[\w.-]+=[\w.-]+)*)?$" apikey_regex = "\\w+"
connection_regex = '^(http|https):\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w.-]+=[\\w.-]+(?:&[\\w.-]+=[\\w.-]+)*)?$' apikey_regex = '\\w+'
class Inventory: def add(item, slot, stat, bag): bag = { "slot": str(slot), "stat": int(stat) } return bag;
class Inventory: def add(item, slot, stat, bag): bag = {'slot': str(slot), 'stat': int(stat)} return bag
BASE_URL = "https://www.booking.com/" HEADERS = [ "Hotel Name", "Type", "Location", "Date Range", "adults", "rooms", "Score", "price", ]
base_url = 'https://www.booking.com/' headers = ['Hotel Name', 'Type', 'Location', 'Date Range', 'adults', 'rooms', 'Score', 'price']
# This file is part of ranger, the console file manager. # License: GNU GPL version 3, see the file "AUTHORS" for details. CONTEXT_KEYS = ['reset', 'error', 'badinfo', 'in_browser', 'in_statusbar', 'in_titlebar', 'in_console', 'in_pager', 'in_taskview', 'active_pane', 'inactive_pane', '...
context_keys = ['reset', 'error', 'badinfo', 'in_browser', 'in_statusbar', 'in_titlebar', 'in_console', 'in_pager', 'in_taskview', 'active_pane', 'inactive_pane', 'directory', 'file', 'hostname', 'executable', 'media', 'link', 'fifo', 'socket', 'device', 'video', 'audio', 'image', 'media', 'document', 'container', 'sel...
class UnauthorizedEvalError(ValueError): pass class UnauthorizedNameAccess(UnauthorizedEvalError, NameError): pass class UnauthorizedCall(UnauthorizedEvalError): pass class UnauthorizedAttributeAccess(UnauthorizedEvalError): pass class UnauthorizedSubscript(UnauthorizedEvalError): pass
class Unauthorizedevalerror(ValueError): pass class Unauthorizednameaccess(UnauthorizedEvalError, NameError): pass class Unauthorizedcall(UnauthorizedEvalError): pass class Unauthorizedattributeaccess(UnauthorizedEvalError): pass class Unauthorizedsubscript(UnauthorizedEvalError): pass
class Macro: def __init__(self, actions, check_sticky): self.actions = actions self.check_sticky = check_sticky def step(self, current_sticky_actions): while len(self.actions) > 0: action = self.actions.pop(0) if self.check_sticky and action not in current_sticky...
class Macro: def __init__(self, actions, check_sticky): self.actions = actions self.check_sticky = check_sticky def step(self, current_sticky_actions): while len(self.actions) > 0: action = self.actions.pop(0) if self.check_sticky and action not in current_stick...
# this program caluclate the sum from 1 to a given number target_number = int(input("Enter a number up to which you wan to calculate the sum from 1: ")) sum_of_numbers = target_number for n in range(1,target_number): sum_of_numbers += n print(f"The total sum of 1 to {target_number} is {sum_of_numbers}")
target_number = int(input('Enter a number up to which you wan to calculate the sum from 1: ')) sum_of_numbers = target_number for n in range(1, target_number): sum_of_numbers += n print(f'The total sum of 1 to {target_number} is {sum_of_numbers}')
class Solution: def solve(self, s): last_char = "" cur_streak_length = 0 best_ans = 0 for i in range(len(s)): cur_char = s[i] if cur_char == last_char: cur_streak_length += 1 else: cur_streak_length = 1 last_char = c...
class Solution: def solve(self, s): last_char = '' cur_streak_length = 0 best_ans = 0 for i in range(len(s)): cur_char = s[i] if cur_char == last_char: cur_streak_length += 1 else: cur_streak_length = 1 ...
# # PySNMP MIB module STN-POLICY-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/STN-POLICY-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:11:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, constraints_intersection, value_range_constraint) ...
def main(): # input N, M = map(int, input().split()) scs = [list(map(int, input().split())) for _ in range(M)] # compute if N == 1: numbers = range(0, 10) elif N == 2: numbers = range(10, 100) else: numbers = range(100, 1000) for i in numbers: flag = True...
def main(): (n, m) = map(int, input().split()) scs = [list(map(int, input().split())) for _ in range(M)] if N == 1: numbers = range(0, 10) elif N == 2: numbers = range(10, 100) else: numbers = range(100, 1000) for i in numbers: flag = True number = list(ma...
#Crie um programa que diga 'Hello World' msg = 'Hello World!' print( msg )
msg = 'Hello World!' print(msg)
class car: def __init__(self): self.__fuelling() def drive(self): print("Driving..!!") def __fuelling(self): print("Refilling Gas") volvo=car() volvo.drive() volvo._car__fuelling()
class Car: def __init__(self): self.__fuelling() def drive(self): print('Driving..!!') def __fuelling(self): print('Refilling Gas') volvo = car() volvo.drive() volvo._car__fuelling()
def dump_vector(x): return ",".join(map(str, x)) def dump_matrix(xs): vs = map(dump_vector, xs) return "{0}#{1}#{2}".format(xs.shape[0], xs.shape[1], "|".join(vs)) def dump_pca(pca): return "{0}\n{1}".format(dump_matrix(pca.components_.T), dump_vector(pca.mean_)) def dump_mlp(mlp): activation = m...
def dump_vector(x): return ','.join(map(str, x)) def dump_matrix(xs): vs = map(dump_vector, xs) return '{0}#{1}#{2}'.format(xs.shape[0], xs.shape[1], '|'.join(vs)) def dump_pca(pca): return '{0}\n{1}'.format(dump_matrix(pca.components_.T), dump_vector(pca.mean_)) def dump_mlp(mlp): activation = m...
def meets_criteria(number): num_str = str(number) # check to see if two number are the same next to each other i = 1 previous = num_str[0] while i < 6 : if previous == num_str[i]: break previous = num_str[i] i+=1 if i == 6: return 0 # no more ...
def meets_criteria(number): num_str = str(number) i = 1 previous = num_str[0] while i < 6: if previous == num_str[i]: break previous = num_str[i] i += 1 if i == 6: return 0 i = 1 found_double = 0 same = 0 previous = num_str[0] while i <...
___assertEqual(+False, 0) ___assertIsNot(+False, False) ___assertEqual(-False, 0) ___assertIsNot(-False, False) ___assertEqual(abs(False), 0) ___assertIsNot(abs(False), False) ___assertEqual(+True, 1) ___assertIsNot(+True, True) ___assertEqual(-True, -1) ___assertEqual(abs(True), 1) ___assertIsNot(abs(True), True) ___a...
___assert_equal(+False, 0) ___assert_is_not(+False, False) ___assert_equal(-False, 0) ___assert_is_not(-False, False) ___assert_equal(abs(False), 0) ___assert_is_not(abs(False), False) ___assert_equal(+True, 1) ___assert_is_not(+True, True) ___assert_equal(-True, -1) ___assert_equal(abs(True), 1) ___assert_is_not(abs(T...
# Will keep track of all the variables and their values class SymbolTable: def __init__(self): self.symbols = {} def get(self, name): value = self.symbols.get(name, None) return value def set(self, name, value): self.symbols[name] = value def remove(self, name): ...
class Symboltable: def __init__(self): self.symbols = {} def get(self, name): value = self.symbols.get(name, None) return value def set(self, name, value): self.symbols[name] = value def remove(self, name): del self.symbols[name]
class BoidRuleAvoid: fear_factor = None object = None use_predict = None
class Boidruleavoid: fear_factor = None object = None use_predict = None
#!/usr/bin/env python # Whites/Pastels snow = (255, 250, 250) snow2 = (238, 233, 233) snow3 = (205, 201, 201) snow4 = (139, 137, 137) ghost_white = (248, 248, 255) white_smoke = (245, 245, 245) gainsboro = (220, 220, 220) white = (255, 255, 255) # Grays black = (0, 0, 0) dark_slate_black = (49, 79, 79) dim_gray = (105...
snow = (255, 250, 250) snow2 = (238, 233, 233) snow3 = (205, 201, 201) snow4 = (139, 137, 137) ghost_white = (248, 248, 255) white_smoke = (245, 245, 245) gainsboro = (220, 220, 220) white = (255, 255, 255) black = (0, 0, 0) dark_slate_black = (49, 79, 79) dim_gray = (105, 105, 105) slate_gray = (112, 138, 144) light_s...
# OSEK Builder Global Variables (OB Globals) # ------------------------------------------ # list of column titles in TASK tab of OSEX-Builder.xlsx TaskParams = ["Task Name", "PRIORITY", "SCHEDULE", "ACTIVATION", "AUTOSTART", "RESOURCE", "EVENT", "MESSAGE", "STACK_SIZE"] TNMI = 0 PRII = 1 SCHI = 2 ACTI = 3 ATSI = 4...
task_params = ['Task Name', 'PRIORITY', 'SCHEDULE', 'ACTIVATION', 'AUTOSTART', 'RESOURCE', 'EVENT', 'MESSAGE', 'STACK_SIZE'] tnmi = 0 prii = 1 schi = 2 acti = 3 atsi = 4 resi = 5 evti = 6 msgi = 7 stsz = 8 cntr_params = ['Counter Name', 'MINCYCLE', 'MAXALLOWEDVALUE', 'TICKSPERBASE', 'TICKDURATION'] cnme = 0 alarm_param...
# -*- coding: utf-8 -*- { 'name': 'Chapter 14 code for the mail template recipe', 'depends': ['mail', 'report_py3o'], 'data': [ 'views/library_book.xml', 'views/library_member.xml', 'data/py3o_server.xml', 'reports/book_loan_report.xml' ], 'demo': ['demo/demo.xml'], }...
{'name': 'Chapter 14 code for the mail template recipe', 'depends': ['mail', 'report_py3o'], 'data': ['views/library_book.xml', 'views/library_member.xml', 'data/py3o_server.xml', 'reports/book_loan_report.xml'], 'demo': ['demo/demo.xml']}
#Write a Python program to remove duplicates from a list. sample_list = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40] duplicate_items =set() unique_list = [] for num in sample_list: if num not in duplicate_items: unique_list.append(num) duplicate_items.add(num) print(unique_list)
sample_list = [10, 20, 30, 20, 10, 50, 60, 40, 80, 50, 40] duplicate_items = set() unique_list = [] for num in sample_list: if num not in duplicate_items: unique_list.append(num) duplicate_items.add(num) print(unique_list)
# coding: utf-8 class CartesianProduct: def extract(self,val,row): if isinstance(val, list): for v in val: row.append(v) else: row.append(val) def combi(self,x, y, result): #print("combi before",x,y,result) row = [] for i in x: ...
class Cartesianproduct: def extract(self, val, row): if isinstance(val, list): for v in val: row.append(v) else: row.append(val) def combi(self, x, y, result): row = [] for i in x: for j in y: self.extract(i, r...
def keywordMatching(amazonTitle,wallmartTitles,wallmartPrices,wallmartIds): #whitelist of letters whitelist = set('abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ') amazonTitle = ''.join(filter(whitelist.__contains__, amazonTitle)) titles = [] commonalities = [] for i in wallmartTitles:...
def keyword_matching(amazonTitle, wallmartTitles, wallmartPrices, wallmartIds): whitelist = set('abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ') amazon_title = ''.join(filter(whitelist.__contains__, amazonTitle)) titles = [] commonalities = [] for i in wallmartTitles: common_words = ...
# -*- coding: utf-8 -*- ''' File name: code\gozinta_chains\sol_548.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x ''' # Solution to Project Euler Problem #548 :: Gozinta Chains # # For more information see: # https://projecteuler.net/problem=548 # Problem Statement ''' A goz...
""" File name: code\\gozinta_chains\\sol_548.py Author: Vaidic Joshi Date created: Oct 20, 2018 Python Version: 3.x """ '\nA gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next.\nThere are eight gozinta chains for 12:\n{1,12} ,{1,2,12}, {1,2,4,12}, {1,2,6,12}, {1...
class RandomVariable: def __init__(self): self._parametrization = None def sample(self): pass def as_tensor(self): pass def make_parametrization(self): pass class Parametrization: def __init__(self): self._free_vars = [] self._trainable_params = [...
class Randomvariable: def __init__(self): self._parametrization = None def sample(self): pass def as_tensor(self): pass def make_parametrization(self): pass class Parametrization: def __init__(self): self._free_vars = [] self._trainable_params = ...
lines = [l.strip() for l in open('input.txt', 'r').readlines()] p1, p2, first_player = [], [], True for line in lines: if 'Player 2' in line: first_player = False if not line or 'Player' in line: continue if first_player: p1.append(int(line)) else: p2.append(int(line)) def determine_winner(p1, p2): memo...
lines = [l.strip() for l in open('input.txt', 'r').readlines()] (p1, p2, first_player) = ([], [], True) for line in lines: if 'Player 2' in line: first_player = False if not line or 'Player' in line: continue if first_player: p1.append(int(line)) else: p2.append(int(line)...
# fibonacci: int -> int # calcula el n-esimo numero de la sucesion de fibonacci # ejemplo: fibonacci(7) debe dar 13 def fibonacci(n): assert type(n) == int and n>=0 if n<2: # caso base return n else: # caso recursivo return fibonacci(n-1) + fibonacci(n-2) # test: assert fib...
def fibonacci(n): assert type(n) == int and n >= 0 if n < 2: return n else: return fibonacci(n - 1) + fibonacci(n - 2) assert fibonacci(0) == 0 assert fibonacci(1) == 1 assert fibonacci(2) == 1 assert fibonacci(7) == 13
def get_gnn_config(parser): parser.add_argument('--ggnn_keep_prob', type=float, default=0.8) parser.add_argument('--t_step', type=int, default=3) parser.add_argument('--embed_layer', type=int, default=1) parser.add_argument('--embed_neuron', type=int, default=256) parser.add_argument('--prop_lay...
def get_gnn_config(parser): parser.add_argument('--ggnn_keep_prob', type=float, default=0.8) parser.add_argument('--t_step', type=int, default=3) parser.add_argument('--embed_layer', type=int, default=1) parser.add_argument('--embed_neuron', type=int, default=256) parser.add_argument('--prop_layer',...
BLACK = 0x000000 WHITE = 0xFFFFFF GRAY = 0x888888 DARKGRAY = 0x484848 ORANGE = 0xFF8800 DARKORANGE = 0xF18701 LIGHTBLUE = 0x5C92D1 BLUE = 0x0000C0 GREEN = 0x00FF00 PASTEL_GREEN = 0x19DF82 SMOKY_GREEN = 0x03876D PINK = 0xD643BB PURPLE = 0x952489 DEEP_PURPLE = 0x890C32 YELLOW = 0xF4ED06 # RED = 0xC80A24 RED = 0xDE0A07 BR...
black = 0 white = 16777215 gray = 8947848 darkgray = 4737096 orange = 16746496 darkorange = 15828737 lightblue = 6066897 blue = 192 green = 65280 pastel_green = 1695618 smoky_green = 231277 pink = 14042043 purple = 9774217 deep_purple = 8981554 yellow = 16051462 red = 14551559 brown = 10173989
# pytools/recursion/subsets.py # # Author: Daniel Clark, 2016 ''' This module contains functions to return all of the subsets of a given set ''' def subsets_reduce(input_set): ''' Reduce function method for returning all subsets of a set ''' return reduce(lambda z, x: z + [y + [x] for y in z], ...
""" This module contains functions to return all of the subsets of a given set """ def subsets_reduce(input_set): """ Reduce function method for returning all subsets of a set """ return reduce(lambda z, x: z + [y + [x] for y in z], input_set, [[]]) def subsets(input_set): """ Return all subse...
number_grid = [ [1, 2, 4], [2, 5, 6], [3, 4, 6] ] print(number_grid[0][0]) print(number_grid[2][2])
number_grid = [[1, 2, 4], [2, 5, 6], [3, 4, 6]] print(number_grid[0][0]) print(number_grid[2][2])
def partition(lst, low, high): # pick last element as pivot pivot = lst[high] # index of where pivot should be index = low for j in range(low, high): if lst[j] < pivot: lst[index], lst[j] = lst[j], lst[index] index += 1 # place pivot at index lst[index], lst[h...
def partition(lst, low, high): pivot = lst[high] index = low for j in range(low, high): if lst[j] < pivot: (lst[index], lst[j]) = (lst[j], lst[index]) index += 1 (lst[index], lst[high]) = (lst[high], lst[index]) return index def quick_sort(lst, low, high): if low...
USERNAME = None PASSWORD = None REQUESTS_URL = 'https://ebusiness.dpb.nhs.uk/claimsrequests.asp' RESPONSE_URL = 'https://ebusiness.dpb.nhs.uk/claimsresponses.asp'
username = None password = None requests_url = 'https://ebusiness.dpb.nhs.uk/claimsrequests.asp' response_url = 'https://ebusiness.dpb.nhs.uk/claimsresponses.asp'
# name_to_binary.py def to_binary(name): text = '' for let in name: code = ord(let) text += bin(code).replace('0b', '') return text # __main__ string = input("Enter a name: ") binary = to_binary(string) print(binary)
def to_binary(name): text = '' for let in name: code = ord(let) text += bin(code).replace('0b', '') return text string = input('Enter a name: ') binary = to_binary(string) print(binary)
class Config(object): _config = {} @classmethod def get_config(cls, name): return cls._config.get(name, None) @classmethod def set_config(cls, name, config): config_dict = {key: getattr(config, key) for key in dir(config) if not key.startswith('__') and not c...
class Config(object): _config = {} @classmethod def get_config(cls, name): return cls._config.get(name, None) @classmethod def set_config(cls, name, config): config_dict = {key: getattr(config, key) for key in dir(config) if not key.startswith('__') and (not callable(key))} ...
#choose 4-9.py cubes=[value**3 for value in range(1,11)] print(cubes) print("The first three items in the list are: "+str(cubes[:3])) print("Three items from the middle of the list are: "+str(cubes[4:7])) print("The last three items in the list are: "+str(cubes[-3:]))
cubes = [value ** 3 for value in range(1, 11)] print(cubes) print('The first three items in the list are: ' + str(cubes[:3])) print('Three items from the middle of the list are: ' + str(cubes[4:7])) print('The last three items in the list are: ' + str(cubes[-3:]))
def extract_shapekey(c): d=c.split(",") e=d[0] f=d[1] g=e.split("(") h=f.split(")") part_1=g[1] part_2=h[0] shapekey=(int(part_1),int(part_2)) return shapekey
def extract_shapekey(c): d = c.split(',') e = d[0] f = d[1] g = e.split('(') h = f.split(')') part_1 = g[1] part_2 = h[0] shapekey = (int(part_1), int(part_2)) return shapekey
def fact(n): fact=1 for i in range(1,n+1): fact=fact*i return fact num=int(input("enter a number: ")) factorial=fact(num) print(factorial)
def fact(n): fact = 1 for i in range(1, n + 1): fact = fact * i return fact num = int(input('enter a number: ')) factorial = fact(num) print(factorial)
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn_22cls.py', '../_base_/datasets/trashcan_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ]
_base_ = ['../_base_/models/mask_rcnn_r50_fpn_22cls.py', '../_base_/datasets/trashcan_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py']
def compute_potential_drain(height_change, rover): mars_grav_constant = 3.177 potential_change = height_change * rover.mass * mars_grav_constant / 10 return (0, potential_change)[potential_change > 0] def compute_energy_drain(old_loc, new_loc, rover): min_adjust = rover.battery_base_movement min...
def compute_potential_drain(height_change, rover): mars_grav_constant = 3.177 potential_change = height_change * rover.mass * mars_grav_constant / 10 return (0, potential_change)[potential_change > 0] def compute_energy_drain(old_loc, new_loc, rover): min_adjust = rover.battery_base_movement min_ad...
# http://www.django-rest-framework.org/ REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'ara.classes.pagination.PageNumberPagination', 'DEFAULT_FILTER_BACKENDS': ( 'rest_framework_filters.backends.RestFrameworkFilterBackend', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions...
rest_framework = {'DEFAULT_PAGINATION_CLASS': 'ara.classes.pagination.PageNumberPagination', 'DEFAULT_FILTER_BACKENDS': ('rest_framework_filters.backends.RestFrameworkFilterBackend',), 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.AllowAny',), 'PAGE_SIZE': 15, 'SERIALIZER_EXTENSIONS': {'AUTO_OPTIMIZE': Tru...
def iq_test(numbers): lst=numbers.split(" ") odd=0 even = 0 for i in lst: if float(i)%2==0: even=even+1 else: odd+=1 u="e" if even>odd else "o" if u=="e": for i in lst: if float(i)%2!=0: indexval=lst.index(i...
def iq_test(numbers): lst = numbers.split(' ') odd = 0 even = 0 for i in lst: if float(i) % 2 == 0: even = even + 1 else: odd += 1 u = 'e' if even > odd else 'o' if u == 'e': for i in lst: if float(i) % 2 != 0: indexval ...
# do not change this line manually # this is managed by git tag and updated on every release __version__ = '0.0.46' # do not change this line manually # this is managed by shell/make-proto.sh and updated on every execution __proto_version__ = '0.0.10'
__version__ = '0.0.46' __proto_version__ = '0.0.10'
YES_NO = ["No", "Yes"] FEATURES = [ ("Name", None), ("Does it have fur?", YES_NO), ("Does it have feathers?", YES_NO), ("Does it lay eggs?", YES_NO), ("Does it produce milk?", YES_NO), ("Can it fly?", YES_NO), ("Can it swim?", YES_NO), ("Is it a predator?", YES_NO), ("Does it have t...
yes_no = ['No', 'Yes'] features = [('Name', None), ('Does it have fur?', YES_NO), ('Does it have feathers?', YES_NO), ('Does it lay eggs?', YES_NO), ('Does it produce milk?', YES_NO), ('Can it fly?', YES_NO), ('Can it swim?', YES_NO), ('Is it a predator?', YES_NO), ('Does it have teeth?', YES_NO), ('Does it have a back...
''' See: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes ''' class HttpStatusCode(object): # 1xx CONTINUE = 100 SWITCHING_PROTOCOLS = 101 PROCESSING = 102 # 2xx OK = 200 CREATED = 201 ACCEPTED = 202 NON_AUTHORITATIVE_INFORMATION = 203 NO_CONTENT = 204 RESET_CONTENT ...
""" See: http://en.wikipedia.org/wiki/List_of_HTTP_status_codes """ class Httpstatuscode(object): continue = 100 switching_protocols = 101 processing = 102 ok = 200 created = 201 accepted = 202 non_authoritative_information = 203 no_content = 204 reset_content = 205 partial_cont...
class Mission: def __init__(self, name, func): self.name = name self._func = func def run(self): self._func()
class Mission: def __init__(self, name, func): self.name = name self._func = func def run(self): self._func()
# -*- coding: utf-8 -*- # Load appconfid default_app_config = 'devilry.devilry_qualifiesforexam_plugin_points.apps.DevilryQualifiesForExamPointsAppConfig'
default_app_config = 'devilry.devilry_qualifiesforexam_plugin_points.apps.DevilryQualifiesForExamPointsAppConfig'
def P_G(G, i, n): t = (1 + i) ** n return (G / i) * (((t - 1) / (i * t)) - (n / t)) def A_G(G, i, n): t = (1 + i) ** n return G * ((1/i) - (n / (t - 1)))
def p_g(G, i, n): t = (1 + i) ** n return G / i * ((t - 1) / (i * t) - n / t) def a_g(G, i, n): t = (1 + i) ** n return G * (1 / i - n / (t - 1))
def checkio(number: int) -> str: res = str(number); if(number % 5 == 0 and number % 3 == 0): return "Fizz Buzz"; elif(number % 3 == 0): return "Fizz"; elif(number % 5 == 0): return "Buzz"; return res;
def checkio(number: int) -> str: res = str(number) if number % 5 == 0 and number % 3 == 0: return 'Fizz Buzz' elif number % 3 == 0: return 'Fizz' elif number % 5 == 0: return 'Buzz' return res
# -*- coding: utf-8 -*- # Scrapy settings; see https://doc.scrapy.org/en/latest/topics/settings.html# BOT_NAME = 'jailscraper' SPIDER_MODULES = ['jailscraper.spiders'] NEWSPIDER_MODULE = 'jailscraper.spiders' RETRY_ENABLED = False USER_AGENT = 'ProPublica Cook County Jail Scraper - contact david.eads@propublica.org...
bot_name = 'jailscraper' spider_modules = ['jailscraper.spiders'] newspider_module = 'jailscraper.spiders' retry_enabled = False user_agent = 'ProPublica Cook County Jail Scraper - contact david.eads@propublica.org for details' cookies_enabled = False robotstxt_obey = True concurrent_requests = 12 autothrottle_enabled ...
FEA_DIMENSION = 80 label_dict = {'alv': 0, 'fas': 1, 'prs': 2, 'pus': 3, 'urd': 4, 'mul': 5} path_conf = { "dev_data": '', "dev_labels": '', "train_list": '', } log_conf = { "base_dir": '', "file_name": '', } summary_conf = { "checkpoint_dir": '', "model_directory": '', "model_name":...
fea_dimension = 80 label_dict = {'alv': 0, 'fas': 1, 'prs': 2, 'pus': 3, 'urd': 4, 'mul': 5} path_conf = {'dev_data': '', 'dev_labels': '', 'train_list': ''} log_conf = {'base_dir': '', 'file_name': ''} summary_conf = {'checkpoint_dir': '', 'model_directory': '', 'model_name': ''} model_conf = {'gru_layer1_units': 256,...
# # PySNMP MIB module IPOMANII-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPOMANII-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:45:07 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019,...
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ...
class AioDiskDBException(Exception): pass class RunningException(AioDiskDBException): pass class NotRunningException(AioDiskDBException): pass class TimeoutException(AioDiskDBException): pass class ReadTimeoutException(AioDiskDBException): pass class DBNotInitializedException(AioDiskDBExce...
class Aiodiskdbexception(Exception): pass class Runningexception(AioDiskDBException): pass class Notrunningexception(AioDiskDBException): pass class Timeoutexception(AioDiskDBException): pass class Readtimeoutexception(AioDiskDBException): pass class Dbnotinitializedexception(AioDiskDBException...
''' Provides a set of normalizing functions ''' FAKE_SCROLL_ID = 'fake-scroll-id' def normalizeResponse(response): ''' Take raw a raw Elasticsearch response and fix it for the Fake implemenation ''' # Remove these fields remove = ['_shards', 'timed_out', 'took'] for field in remove: ...
""" Provides a set of normalizing functions """ fake_scroll_id = 'fake-scroll-id' def normalize_response(response): """ Take raw a raw Elasticsearch response and fix it for the Fake implemenation """ remove = ['_shards', 'timed_out', 'took'] for field in remove: if field in response: ...
# input drink_type = input() sugar = input() drinks_count = int(input()) drink_price = 0 if drink_type == 'Espresso': if sugar == 'Without': drink_price = 0.90 elif sugar == 'Normal': drink_price = 1 elif sugar == 'Extra': drink_price = 1.20 elif drink_type == 'Cappuccino': if ...
drink_type = input() sugar = input() drinks_count = int(input()) drink_price = 0 if drink_type == 'Espresso': if sugar == 'Without': drink_price = 0.9 elif sugar == 'Normal': drink_price = 1 elif sugar == 'Extra': drink_price = 1.2 elif drink_type == 'Cappuccino': if sugar == 'Wi...
a = [1, 2, 3, 4] sumNum = 0 for i in a: # In the for loop, "i" will sequentially read the values in list a. sumNum += i # sumNum = sumNum + i, means, 0 + 1 > (0+1) + 2 > (1+2) + 3 > (3+3) + 4 print(sumNum)
a = [1, 2, 3, 4] sum_num = 0 for i in a: sum_num += i print(sumNum)
# Constant.py # Color BLUE = 'BLUE' GREEN = 'GREEN' # LISTENER HTTPS_TUPLE = ('HTTPS', 443) HTTP_TUPLE = ('HTTP', 80) # Target group TARGET_GROUP_COLOR_TAG_NAME = 'Color' TARGET_GROUP_TYPE_TAG_NAME = 'Type' # Default type means 'api gateway' TARGET_GROUP_DEFAULT_TYPE = 'DEFAULT' TARGET_GROUP_MAINTENANCE_TYPE = 'MAIN...
blue = 'BLUE' green = 'GREEN' https_tuple = ('HTTPS', 443) http_tuple = ('HTTP', 80) target_group_color_tag_name = 'Color' target_group_type_tag_name = 'Type' target_group_default_type = 'DEFAULT' target_group_maintenance_type = 'MAINTENANCE' ecr_service_prefix = 'lcdp-' default_desired_count = 2 default_max_capacity =...
class ConfigurationException(Exception): pass class InternalException(Exception): pass class InvalidMessage(Exception): pass class InvalidPartialUpdate(Exception): pass
class Configurationexception(Exception): pass class Internalexception(Exception): pass class Invalidmessage(Exception): pass class Invalidpartialupdate(Exception): pass
def f(x: int): y = x def g(i: int): f(i + 2) g(3)
def f(x: int): y = x def g(i: int): f(i + 2) g(3)
def get_int(prompt, int_range): i = 0 while True: try: i = int(input(prompt)) if i in int_range: break except ValueError: pass return i
def get_int(prompt, int_range): i = 0 while True: try: i = int(input(prompt)) if i in int_range: break except ValueError: pass return i
fights = int(input()) helmet_price = float(input()) sword_price = float(input()) shield_price = float(input()) armor_price = float(input()) shield_counter = 0 expenses = 0 for fight in range(1, fights + 1): if fight % 2 == 0: expenses += helmet_price if fight % 3 == 0: expenses +=...
fights = int(input()) helmet_price = float(input()) sword_price = float(input()) shield_price = float(input()) armor_price = float(input()) shield_counter = 0 expenses = 0 for fight in range(1, fights + 1): if fight % 2 == 0: expenses += helmet_price if fight % 3 == 0: expenses += sword_price ...
output = ''' Using interface 'wlan0' bssid=14:d6:4d:ec:1e:88 ssid=AU Test Network id=1 mode=station pairwise_cipher=CCMP group_cipher=CCMP key_mgmt=WPA2-PSK wpa_state=COMPLETED ip_address=192.168.20.70 p2p_device_address=e0:cb:1d:3d:84:71 address=e0:cb:1d:3d:84:71 ''' mac = "e0:cb:1d:3d:84:71" ip = "19...
output = "\nUsing interface 'wlan0'\nbssid=14:d6:4d:ec:1e:88\nssid=AU Test Network\nid=1\nmode=station\npairwise_cipher=CCMP\ngroup_cipher=CCMP\nkey_mgmt=WPA2-PSK\nwpa_state=COMPLETED\nip_address=192.168.20.70\np2p_device_address=e0:cb:1d:3d:84:71\naddress=e0:cb:1d:3d:84:71\n" mac = 'e0:cb:1d:3d:84:71' ip = '192.168.20...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- MONGO_URL = 'localhost' MONGO_DB = 'huawei' MONGO_TABLE = 'huawei_product'
mongo_url = 'localhost' mongo_db = 'huawei' mongo_table = 'huawei_product'
class Solution: def minInsertions(self, s: str) -> int: # use stack stack = [] count = 0 i=0 while i < len(s): if s[i] == '(': stack.append(s[i]) i += 1 else: # when facing empty stack if ...
class Solution: def min_insertions(self, s: str) -> int: stack = [] count = 0 i = 0 while i < len(s): if s[i] == '(': stack.append(s[i]) i += 1 elif not stack: if i + 1 < len(s) and s[i + 1] == ')': ...
def test_loop(num): for a in num: print ("a : ", a) yield a num = [1, 2, 3] tl = test_loop(num) for aa in tl: print ("aa : ", aa)
def test_loop(num): for a in num: print('a : ', a) yield a num = [1, 2, 3] tl = test_loop(num) for aa in tl: print('aa : ', aa)
class SchedulerNoam(object): def __init__(self, warmup: int, model_size: int): super().__init__() self.warmup = warmup self.model_size = model_size def get_learning_rate(self, step: int): step = max(1, step) return self.model_size ** (-0.5) * min(step ** (-0.5), step ...
class Schedulernoam(object): def __init__(self, warmup: int, model_size: int): super().__init__() self.warmup = warmup self.model_size = model_size def get_learning_rate(self, step: int): step = max(1, step) return self.model_size ** (-0.5) * min(step ** (-0.5), step * ...
names=['yash','manan','jahnavi','rahul','rutu','Harry'] print(names[0]) names[1]='Manan Sanghavi' print(names[1]) names[1]=3 print(names[1]) print(type(names))
names = ['yash', 'manan', 'jahnavi', 'rahul', 'rutu', 'Harry'] print(names[0]) names[1] = 'Manan Sanghavi' print(names[1]) names[1] = 3 print(names[1]) print(type(names))
class Solution: def numFactoredBinaryTrees(self, A: 'List[int]') -> 'int': ids = {x : i for i, x in enumerate(A)} g = {x : [] for x in A} A.sort() for i in range(len(A)): for j in range(len(A)): if A[j] % A[i] == 0 and (A[j] // A[i]) in ids: ...
class Solution: def num_factored_binary_trees(self, A: 'List[int]') -> 'int': ids = {x: i for (i, x) in enumerate(A)} g = {x: [] for x in A} A.sort() for i in range(len(A)): for j in range(len(A)): if A[j] % A[i] == 0 and A[j] // A[i] in ids: ...
# Python does not have built-in support for Arrays, # but Python Lists can be used instead. def showArrays(): cars = ["Ford", "Volvo", "BMW"] for car in cars: print("Car Type : ", car) # Add some new cars cars.append("Mercedes") cars.append("Maruti") print("All cars : ", cars)...
def show_arrays(): cars = ['Ford', 'Volvo', 'BMW'] for car in cars: print('Car Type : ', car) cars.append('Mercedes') cars.append('Maruti') print('All cars : ', cars) for i in cars: car_index = cars.index(i) print(i + '<=========>' + str(carIndex)) print('Size of the ...
data = open("input.txt", "r").readlines() fold = [] points = [] for line in data: if len(line.strip()) == 0: continue elif line.startswith("fold"): [x_or_y, value] = line.replace("fold along ", "").split("=") fold.append((int(value) if x_or_y == "x" else 0, int(valu...
data = open('input.txt', 'r').readlines() fold = [] points = [] for line in data: if len(line.strip()) == 0: continue elif line.startswith('fold'): [x_or_y, value] = line.replace('fold along ', '').split('=') fold.append((int(value) if x_or_y == 'x' else 0, int(value) if x_or_y == 'y' el...
# #Q1 def eh_quadrada(mat): null=[] l=len(mat) if mat == null or l == len(mat[0]): return True for i in range(l): if mat[i] == null: return True else: return False #Q2 def conta_numero(n,mat): ls=[] l=len(mat) if mat == ls: return 0 for i i...
def eh_quadrada(mat): null = [] l = len(mat) if mat == null or l == len(mat[0]): return True for i in range(l): if mat[i] == null: return True else: return False def conta_numero(n, mat): ls = [] l = len(mat) if mat == ls: return 0 for i i...
class Solution: def insertIntoBST(self, root: TreeNode, val: int) -> TreeNode: if not root: return TreeNode(val) if val > root.val: root.right = self.insertIntoBST(root.right, val) else: root.left = self.insertIntoBST(root.left, val) r...
class Solution: def insert_into_bst(self, root: TreeNode, val: int) -> TreeNode: if not root: return tree_node(val) if val > root.val: root.right = self.insertIntoBST(root.right, val) else: root.left = self.insertIntoBST(root.left, val) return roo...
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Difference of Volumes of Cuboids #Problem level: 8 kyu def find_difference(a, b): return abs((a[0]*a[1]*a[2])-(b[0]*b[1]*b[2]))
def find_difference(a, b): return abs(a[0] * a[1] * a[2] - b[0] * b[1] * b[2])
# constants # team_number = 0 # flags # # simulation sim_enable_flag = False sim_activate_flag = False # telemetry transmission cx_flag = False sp1x_flag = False sp2x_flag = False # mqtt mqtt_flag = False # payload deployment sp1_deployed_flag = False sp2_deployed_flag = False
team_number = 0 sim_enable_flag = False sim_activate_flag = False cx_flag = False sp1x_flag = False sp2x_flag = False mqtt_flag = False sp1_deployed_flag = False sp2_deployed_flag = False