content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
# # PySNMP MIB module CISCO-VSI-MASTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-VSI-MASTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:19:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ...
#Use string concatenation and the len() function to find the length of a certain movie star's actual full name. Store that length in the name_length variable. Don't forget that there are spaces in between the different parts of a name! given_name = "William" middle_names = "Bradley" family_name = "Pitt" name_length =...
given_name = 'William' middle_names = 'Bradley' family_name = 'Pitt' name_length = len(given_name + ' ' + middle_names + ' ' + family_name) driving_license_character_limit = 28 print(name_length <= driving_license_character_limit)
class AddLayer: def __init__(self): pass def forward(self, x, y): out = x + y return out def backward(self, dout): dx = dout * 1 dy = dout * 1 return dx, dy class MulLayer: def __init__(self): self.x = None self.y = None ...
class Addlayer: def __init__(self): pass def forward(self, x, y): out = x + y return out def backward(self, dout): dx = dout * 1 dy = dout * 1 return (dx, dy) class Mullayer: def __init__(self): self.x = None self.y = None def for...
class TabularWriterSTDOUT(object): def __init__(self, columns:list, colWidth:int): self.__columns = columns self.__colWidth = colWidth s = "" self.__proto = [] for i in range(0, len(columns)): self.__proto.append("-") n = i * colWidth while len(s) < n: s += " " s += columns[i] print(...
class Tabularwriterstdout(object): def __init__(self, columns: list, colWidth: int): self.__columns = columns self.__colWidth = colWidth s = '' self.__proto = [] for i in range(0, len(columns)): self.__proto.append('-') n = i * colWidth wh...
class Solution: def minSteps(self, n: int) -> int: result = 0 factor = 2 while n > 1: while n % factor == 0: result += factor n /= factor factor += 1 return result
class Solution: def min_steps(self, n: int) -> int: result = 0 factor = 2 while n > 1: while n % factor == 0: result += factor n /= factor factor += 1 return result
def fold_x(n,field): new_field=set() for x,y in field: if x<n: new_field.add((x,y)) elif x>n: if 2*n-x<0: print("WARNING: FOLD RESULTED IN NEGATIVE COORDINATE X") new_field.add((2*n-x,y)) else: print("WARNING: DOT ON FOLD LI...
def fold_x(n, field): new_field = set() for (x, y) in field: if x < n: new_field.add((x, y)) elif x > n: if 2 * n - x < 0: print('WARNING: FOLD RESULTED IN NEGATIVE COORDINATE X') new_field.add((2 * n - x, y)) else: print('W...
numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] squared_numbers = [n**2 for n in numbers] print(squared_numbers)
numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] squared_numbers = [n ** 2 for n in numbers] print(squared_numbers)
scoring_rules = [[100, 200, 1000, 2000, 4000, 5000], [0, 0, 200, 400, 800, 5000], [0, 0, 300, 600, 1200, 5000], [0, 0, 400, 800, 1600, 5000], [50, 100, 500, 1000, 2000, 5000], [0, 0, 600, 1200, 2400, 5000]] overlord_scoring_rules = [[...
scoring_rules = [[100, 200, 1000, 2000, 4000, 5000], [0, 0, 200, 400, 800, 5000], [0, 0, 300, 600, 1200, 5000], [0, 0, 400, 800, 1600, 5000], [50, 100, 500, 1000, 2000, 5000], [0, 0, 600, 1200, 2400, 5000]] overlord_scoring_rules = [[100, 200, 1000, 2000, 4000, 5000], [0, 0, 0, 0, 0, 5000], [0, 0, 300, 600, 1200, 5000]...
def ip2bin(ip): nums = ip.split(".") nums = list(map(lambda x: int(x), nums)) total = (nums[0]<<24) + (nums[1]<<16) + (nums[2]<<8) + nums[3] return total def bin2ip(num): nums = [0, 0, 0, 0] nums[0] = (num & 0b11111111000000000000000000000000)>>24 nums[1] = (num & 0b00000000111111110000000000000000)>>16...
def ip2bin(ip): nums = ip.split('.') nums = list(map(lambda x: int(x), nums)) total = (nums[0] << 24) + (nums[1] << 16) + (nums[2] << 8) + nums[3] return total def bin2ip(num): nums = [0, 0, 0, 0] nums[0] = (num & 4278190080) >> 24 nums[1] = (num & 16711680) >> 16 nums[2] = (num & 65280...
#How to merge 2 dictionaries in python 3.5+ # using "unpacking generalisations" a = {'a': 1, 'b': 2} b = {'c': 3, 'd': 4} c = {'b': 3, 'c': 4} x = {**a, **b} y = {**a, **c} # the 'b' value in a is replaced by the 'b' value in c z = {**a, **b, **c} # the 'c' value in b is replaced by the 'c' value in d assert x == {'...
a = {'a': 1, 'b': 2} b = {'c': 3, 'd': 4} c = {'b': 3, 'c': 4} x = {**a, **b} y = {**a, **c} z = {**a, **b, **c} assert x == {'a': 1, 'b': 2, 'c': 3, 'd': 4} assert y == {'a': 1, 'b': 3, 'c': 4} assert z == {'a': 1, 'b': 3, 'c': 4, 'd': 4}
def test_init_database(api_client): response = api_client.get("/create/init") try: assert response.json().get("status") == "created" except AssertionError: raise AssertionError(response.json()) def test_reinit_database(api_client): response = api_client.get("/create/reinit") try: ...
def test_init_database(api_client): response = api_client.get('/create/init') try: assert response.json().get('status') == 'created' except AssertionError: raise assertion_error(response.json()) def test_reinit_database(api_client): response = api_client.get('/create/reinit') try: ...
class ErrorReporter: def __init__(self, app): self.app = app def report(self, err, metadata=None): raise NotImplementedError()
class Errorreporter: def __init__(self, app): self.app = app def report(self, err, metadata=None): raise not_implemented_error()
class Room(object): COMPASS = ['N','E','S','W'] def __init__(self, room_x, room_y): self.room_x = room_x self.room_y = room_y self.passages = {} def go_forward(self, direction): return(self.passages.get(direction, None)) def get_left_direction(self, direction): idx = (self.COMPASS.index(direction) - 1...
class Room(object): compass = ['N', 'E', 'S', 'W'] def __init__(self, room_x, room_y): self.room_x = room_x self.room_y = room_y self.passages = {} def go_forward(self, direction): return self.passages.get(direction, None) def get_left_direction(self, direction): ...
# coding: utf-8 class test: def __init__(self): self.q = Queue() self.proc = Process(target=self._do_something,) def __del__(self): try: print('* stopping process ') self.proc.terminate() except Exception as e: print('* failed to terminate pro...
class Test: def __init__(self): self.q = queue() self.proc = process(target=self._do_something) def __del__(self): try: print('* stopping process ') self.proc.terminate() except Exception as e: print('* failed to terminate process, sending SI...
file_input = open('isheap.in', 'r') file_output = open('isheap.out', 'w') flag = "YES" n = int(file_input.readline()) arr = list(map(int, file_input.readline().split())) for i in range(1, n): if 2*i <= n: if arr[i - 1] > arr[2*i - 1]: flag = "NO" break if 2*i + 1 <= n: if...
file_input = open('isheap.in', 'r') file_output = open('isheap.out', 'w') flag = 'YES' n = int(file_input.readline()) arr = list(map(int, file_input.readline().split())) for i in range(1, n): if 2 * i <= n: if arr[i - 1] > arr[2 * i - 1]: flag = 'NO' break if 2 * i + 1 <= n: ...
class RTablaDeSimbolos: def __init__(self): ''' Reporte Tabla de Simbolos''' def crearReporte(self,ts_global): f = open("reportes/ts.html", "w") f.write("<!DOCTYPE html>") f.write("<html lang=\"en\" class=\"no-js\">") f.write("") f.write("<head>") f.writ...
class Rtabladesimbolos: def __init__(self): """ Reporte Tabla de Simbolos""" def crear_reporte(self, ts_global): f = open('reportes/ts.html', 'w') f.write('<!DOCTYPE html>') f.write('<html lang="en" class="no-js">') f.write('') f.write('<head>') f.write(...
COMMON = { "a" : ("mi", {}, "var", "a"), "d" : ("mo", {"form": "prefix", "rspace": "0"}, "operator", "d"), "e" : ("mi", {}, "constant", "e"), "f" : ("mo", {}, "var", "f"), "i" : ("mi", {"mathvariant": "italic"}, "constant", "i"), "j" : ("mi", {"mathvariant": "italic"}, "constant", "j"), "k" ...
common = {'a': ('mi', {}, 'var', 'a'), 'd': ('mo', {'form': 'prefix', 'rspace': '0'}, 'operator', 'd'), 'e': ('mi', {}, 'constant', 'e'), 'f': ('mo', {}, 'var', 'f'), 'i': ('mi', {'mathvariant': 'italic'}, 'constant', 'i'), 'j': ('mi', {'mathvariant': 'italic'}, 'constant', 'j'), 'k': ('mi', {'mathvariant': 'italic'}, ...
def matrixTranspose(A): B = [ [A[j][i] for j in range(len(A))] for i in range(len(A[0])) ] return B A = [ [1.0, 2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0, 10.0] ] print( matrixTranspose(A) ) print( A )
def matrix_transpose(A): b = [[A[j][i] for j in range(len(A))] for i in range(len(A[0]))] return B a = [[1.0, 2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0, 10.0]] print(matrix_transpose(A)) print(A)
bytecode = { "mint" : [76, 73, 66, 82, 65, 86, 77, 10, 1, 0, 7, 1, 74, 0, 0, 0, 6, 0, 0, 0, 3, 80, 0, 0, 0, 6, 0, 0, 0, 13, 86, 0, 0, 0, 6, 0, 0, 0, 14, 92, 0, 0, 0, 6, 0, 0, 0, 5, 98, 0, 0, 0, 51, 0, 0, 0, 4, 149, 0, 0, 0, 32, 0, 0, 0, 8, 181, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 3, 0, 1, 4, 0, 2, 0, 2, 4, ...
bytecode = {'mint': [76, 73, 66, 82, 65, 86, 77, 10, 1, 0, 7, 1, 74, 0, 0, 0, 6, 0, 0, 0, 3, 80, 0, 0, 0, 6, 0, 0, 0, 13, 86, 0, 0, 0, 6, 0, 0, 0, 14, 92, 0, 0, 0, 6, 0, 0, 0, 5, 98, 0, 0, 0, 51, 0, 0, 0, 4, 149, 0, 0, 0, 32, 0, 0, 0, 8, 181, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, 3, 0, 1, 4, 0, 2, 0, 2, 4, 2, 0, 3...
somaInter = 0 somaGremio = 0 totalGrenal = 0 empate = 0 novo = 0 while(novo != 2): inter, gremio = map(int, input().split()) totalGrenal += 1 if inter > gremio: somaInter += 1 elif inter == gremio: empate += 1 else: somaGremio +=1 print("Novo grenal (1-sim 2-nao)") novo = int(input()) print(...
soma_inter = 0 soma_gremio = 0 total_grenal = 0 empate = 0 novo = 0 while novo != 2: (inter, gremio) = map(int, input().split()) total_grenal += 1 if inter > gremio: soma_inter += 1 elif inter == gremio: empate += 1 else: soma_gremio += 1 print('Novo grenal (1-sim 2-nao)'...
# update account info class DtlAccountPatchModel: def __init__(self): self.company_name = None self.phone_number = None def get_json_object(self): return { 'companyName': self.company_name, 'phoneNumber': self.phone_number, }
class Dtlaccountpatchmodel: def __init__(self): self.company_name = None self.phone_number = None def get_json_object(self): return {'companyName': self.company_name, 'phoneNumber': self.phone_number}
c1 = input() c2 = input() c3 = input() ans = c1[0] + c2[1] + c3[2] print(ans)
c1 = input() c2 = input() c3 = input() ans = c1[0] + c2[1] + c3[2] print(ans)
class SequenceCrop: max_x = None max_y = None min_x = None min_y = None
class Sequencecrop: max_x = None max_y = None min_x = None min_y = None
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isCousins(self, root: TreeNode, x: int, y: int) -> bool: if not root: return False ret = [] level...
class Solution: def is_cousins(self, root: TreeNode, x: int, y: int) -> bool: if not root: return False ret = [] level = [root] while level: temp = [] for node in level: temp.extend([node.left, node.right]) level = [lea...
# 020 - Write a Python program to get a string which is n (non-negative integer) copies of a given string. def largerString(pString, pNumber): return pString * pNumber print(largerString('abc', 2)) print(largerString('.py', 3))
def larger_string(pString, pNumber): return pString * pNumber print(larger_string('abc', 2)) print(larger_string('.py', 3))
class Daudit: def __init__(self, jobs): self._jobs = jobs def run(self): for job in self._jobs: # Async spawn auditer with job x = 4 # Wait for some job to return # get result from job # send_result to app y = 4
class Daudit: def __init__(self, jobs): self._jobs = jobs def run(self): for job in self._jobs: x = 4 y = 4
Desc = cellDescClass("RFRDX1") Desc.properties["cell_leakage_power"] = "135.409968" Desc.properties["dont_touch"] = "true" Desc.properties["dont_use"] = "true" Desc.properties["cell_footprint"] = "regcout" Desc.properties["area"] = "16.632000" Desc.pinOrder = ['BRB', 'RB'] Desc.add_arc("RB","BRB","combi") Desc.set_job(...
desc = cell_desc_class('RFRDX1') Desc.properties['cell_leakage_power'] = '135.409968' Desc.properties['dont_touch'] = 'true' Desc.properties['dont_use'] = 'true' Desc.properties['cell_footprint'] = 'regcout' Desc.properties['area'] = '16.632000' Desc.pinOrder = ['BRB', 'RB'] Desc.add_arc('RB', 'BRB', 'combi') Desc.set_...
def isnumeric(*args): if not args: return False for arg in args: if type(arg) not in (int, float): return False return True
def isnumeric(*args): if not args: return False for arg in args: if type(arg) not in (int, float): return False return True
class LpdmEvent(object): def __init__(self, ttie, value, name=None): self.ttie = ttie self.value = value self.name = name def __repr__(self): if self.name is None: return "Task: {} -> {}".format(self.ttie, self.value) else: return "Task {}: {} ->...
class Lpdmevent(object): def __init__(self, ttie, value, name=None): self.ttie = ttie self.value = value self.name = name def __repr__(self): if self.name is None: return 'Task: {} -> {}'.format(self.ttie, self.value) else: return 'Task {}: {} ->...
class Stack: def __init__(self): self.items = [] def isEmpty(self): if self.items == []: return True else: return False def push(self, item): self.items.append(item) def pop(self): if len(self.items) != 0: return self.items.p...
class Stack: def __init__(self): self.items = [] def is_empty(self): if self.items == []: return True else: return False def push(self, item): self.items.append(item) def pop(self): if len(self.items) != 0: return self.items...
# decoding.py # ------------------------------------------------------------------------------------------- # # returns the value of the first controlfield with the wanted tag as string def get_controlfield(record, wanted_tag): for datafield in record: datafield_tag = datafield.get('tag') ...
def get_controlfield(record, wanted_tag): for datafield in record: datafield_tag = datafield.get('tag') if datafield_tag == wanted_tag: return datafield.text def get_datafields(record, wanted_tag): collection = [] for datafield in record: datafield_tag = datafield.get('t...
def mapper(word): alphs = list("abcdefghijklmnopqrstuvwxyz") n_word = [] #new word holder for l in word: n_word.append(alphs[alphs.index(l)+2]) print(n_word) mapper("")
def mapper(word): alphs = list('abcdefghijklmnopqrstuvwxyz') n_word = [] for l in word: n_word.append(alphs[alphs.index(l) + 2]) print(n_word) mapper('')
N = int(input()) d_list = [] for i in range(N): d_list.append(int(input())) print(len(set(d_list)))
n = int(input()) d_list = [] for i in range(N): d_list.append(int(input())) print(len(set(d_list)))
number = int(input()) for each in range(1, number): print(" " * (number - each), end="") print("*" * each) print("*" * number) for each in range(number-1, 0, -1): print(" " * (number - each), end="") print("*" * each)
number = int(input()) for each in range(1, number): print(' ' * (number - each), end='') print('*' * each) print('*' * number) for each in range(number - 1, 0, -1): print(' ' * (number - each), end='') print('*' * each)
''' Setup file to be called by optoBot_v1.0.py Stuff to implement : - Add front-end - Boot up browser - Set to fullscreen - Pre-code all clicks and mouse moves - Log in to binomo (pre-login/use .json file method) - Set to 3 candlesticks mode (pre-done/manual) - Add variable to json ...
""" Setup file to be called by optoBot_v1.0.py Stuff to implement : - Add front-end - Boot up browser - Set to fullscreen - Pre-code all clicks and mouse moves - Log in to binomo (pre-login/use .json file method) - Set to 3 candlesticks mode (pre-done/manual) - Add variable to json file to d...
#using for loop inp = input("Enter a value ") reverse = "" for i in inp: reverse = i + reverse print(reverse)
inp = input('Enter a value ') reverse = '' for i in inp: reverse = i + reverse print(reverse)
def cons(x, y): ''' cons(x, y) takes its two arguments and puts them into a python tuple. This tuple can be used to represent a node in a linked list, or a pair ''' return (x, y) def car(x): ''' car(cons(x, y)) returns x. In other words, car returns the head of a linked list or the left ite...
def cons(x, y): """ cons(x, y) takes its two arguments and puts them into a python tuple. This tuple can be used to represent a node in a linked list, or a pair """ return (x, y) def car(x): """ car(cons(x, y)) returns x. In other words, car returns the head of a linked list or the left ite...
fin = open("input") fout = open("output", "w") fout.write("i 0\ns 1") fout.close()
fin = open('input') fout = open('output', 'w') fout.write('i 0\ns 1') fout.close()
# Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'variables': { 'chromium_code': 1, 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/ios/chrome', 'ui_string_overrider_inputs': [ '<(SHARED_I...
{'variables': {'chromium_code': 1, 'grit_out_dir': '<(SHARED_INTERMEDIATE_DIR)/ios/chrome', 'ui_string_overrider_inputs': ['<(SHARED_INTERMEDIATE_DIR)/components/strings/grit/components_locale_settings.h', '<(SHARED_INTERMEDIATE_DIR)/components/strings/grit/components_strings.h', '<(SHARED_INTERMEDIATE_DIR)/ios/chrome/...
# model settings model = dict( type='Recognizer3D', backbone=dict( type='ResNet3d', pretrained2d=True, pretrained='torchvision://resnet50', depth=50, conv_cfg=dict(type='Conv3d'), norm_eval=False, inflate=((1, 1, 1), (1, 0, 1, 0), (1, 0, 1, 0, 1, 0), (0, 1...
model = dict(type='Recognizer3D', backbone=dict(type='ResNet3d', pretrained2d=True, pretrained='torchvision://resnet50', depth=50, conv_cfg=dict(type='Conv3d'), norm_eval=False, inflate=((1, 1, 1), (1, 0, 1, 0), (1, 0, 1, 0, 1, 0), (0, 1, 0)), zero_init_residual=False), cls_head=dict(type='I3DHead', num_classes=400, in...
# test for native generators # simple generator with yield and return @micropython.native def gen1(x): yield x yield x + 1 return x + 2 g = gen1(3) print(next(g)) print(next(g)) try: next(g) except StopIteration as e: print(e.args[0]) # using yield from @micropython.native def gen2(x): yield...
@micropython.native def gen1(x): yield x yield (x + 1) return x + 2 g = gen1(3) print(next(g)) print(next(g)) try: next(g) except StopIteration as e: print(e.args[0]) @micropython.native def gen2(x): yield from range(x) print(list(gen2(3))) @micropython.native def gen3(): try: yiel...
class UnknownKeyPressedOpSubOpCode(ValueError): def __init__(self, invalidSubOpCode: int): super().__init__(f"Invalid key pressed subOpCode: {invalidSubOpCode:x}")
class Unknownkeypressedopsubopcode(ValueError): def __init__(self, invalidSubOpCode: int): super().__init__(f'Invalid key pressed subOpCode: {invalidSubOpCode:x}')
CODE_0_SUCCESS = 0 CODE_1_ERROR = 1 CODE_2_LOGIN_REQUIRED = 2 CODE_3_ERROR_SECURE_TOKEN = 3 CODE_4_ERROR_USERNAME_OR_PASSWORD = 4 CODE_5_INVALID_PASSWORD = 5 CODE_6_USER_CREATION_FAILED = 6 CODE_7_SEND_SMS_FAILED = 7 CODE_8_CAPTCHA_VALIDATION_ERROR = 8 CODE_9_INVALID_PHONE_NUMBER = 9 CODE_10_INVALID_EMAIL_ADDRESS = 10...
code_0_success = 0 code_1_error = 1 code_2_login_required = 2 code_3_error_secure_token = 3 code_4_error_username_or_password = 4 code_5_invalid_password = 5 code_6_user_creation_failed = 6 code_7_send_sms_failed = 7 code_8_captcha_validation_error = 8 code_9_invalid_phone_number = 9 code_10_invalid_email_address = 10 ...
# Config.py DO NOT CHECK THIS INTO A PUBLICLY VIEWABLE GIT REPO!!! # Copy to config.py. Modify values with what you got from # your REST App registration on developer.blackboard.com # Use: # from config import adict # KEY = adict['learn_rest_key'] # SECRET = adict['learn_rest_key'] # LEARNFQDN = adict['learn_rest_fqdn...
adict = {'learn_rest_fqdn': 'your.learnserver.net', 'learn_rest_key': 'Your REST API KEY GOES HERE NOT Mine', 'learn_rest_secret': 'Your REST API SECRET GOES HEREer'}
def should_patch_file(path: str) -> object: return path.endswith('CMakeLists.txt') or path.endswith('base.h') def process_file_line(lineno: int, line: str, arg: object) -> str: if line.strip() == 'project(FlatBuffers)': line = '# Patched by MLTK\n' line += 'cmake_policy(SET CMP0048 NEW)\n' ...
def should_patch_file(path: str) -> object: return path.endswith('CMakeLists.txt') or path.endswith('base.h') def process_file_line(lineno: int, line: str, arg: object) -> str: if line.strip() == 'project(FlatBuffers)': line = '# Patched by MLTK\n' line += 'cmake_policy(SET CMP0048 NEW)\n' ...
ONLINE = 1 OFFLINE = 0 TRAIN = 0 TRAM = 1 BUS = 2 VLINE_TRAIN = 3 NIGHT_BUS = 4
online = 1 offline = 0 train = 0 tram = 1 bus = 2 vline_train = 3 night_bus = 4
x = { "brand": "Ford", "model": "Mustang", "year": 1964, "color":"brown" } print(x["brand"]) x["son"]="jem" print(x.get("color")) print(x["year"]) print(x) for a in x: print(a) #gives keys print(x[a]) #gives values print(x.popitem()) # removes random item print(x.values()) for l,m in x.items(): pr...
x = {'brand': 'Ford', 'model': 'Mustang', 'year': 1964, 'color': 'brown'} print(x['brand']) x['son'] = 'jem' print(x.get('color')) print(x['year']) print(x) for a in x: print(a) print(x[a]) print(x.popitem()) print(x.values()) for (l, m) in x.items(): print(l, m) if 'son' in x: print('exists', x['son'])...
# sorting algorithm with average case O(nlogn), worst cast O(n^2). In place sorting which is nice. def quicksort(A, p, r): if p < r: # if p is not less than r we are at our base case q = partition(A, p, r) # q is a pivot value. Partition guarantees the following: # 1) All the values to the left of q are less than...
def quicksort(A, p, r): if p < r: q = partition(A, p, r) quicksort(A, p, q - 1) quicksort(A, q + 1, r) def partition(A, p, r): x = A[r] i = p - 1 for j in range(p, r): if A[j] <= x: i = i + 1 exchange(A, i, j) exchange(A, i + 1, r) return ...
class Solution: def maxUniqueSplit(self, s: str) -> int: visited = set() def dfs(curr): if curr == len(s): return 0 count = 0 for i in range(curr, len(s)): ss = s[curr : i + 1] if ss in visited: c...
class Solution: def max_unique_split(self, s: str) -> int: visited = set() def dfs(curr): if curr == len(s): return 0 count = 0 for i in range(curr, len(s)): ss = s[curr:i + 1] if ss in visited: ...
#concatenateLists list1 = [5, 4, 9, 10, 3, 5] list2 = [6, 3, 2, 1, 5, 3] join_lists = list1 + list2 print("list1:", list1) print("list2:", list2) print(join_lists)
list1 = [5, 4, 9, 10, 3, 5] list2 = [6, 3, 2, 1, 5, 3] join_lists = list1 + list2 print('list1:', list1) print('list2:', list2) print(join_lists)
def tweak(s): # Note: take tabu_search into consideration when implementing this method. MAYBE you want your solution to include # a description of the tweak. For example, maybe you want to return something like: # ("move item x from bin y to z", tweaked_s) # TODO pass
def tweak(s): pass
def dump_parameters(G, filename): with open(filename, "w") as f: fmt_str_float = '%-20s %g\n' fmt_str_int = '%-20s %d\n' fmt_str_str = '%-20s %s\n' f.write(fmt_str_str % ('bc', G.bc)) f.write(fmt_str_float % ('Cm', G.Cm)) f.write(fmt_str_float % ('Cg', G.Cg)) ...
def dump_parameters(G, filename): with open(filename, 'w') as f: fmt_str_float = '%-20s %g\n' fmt_str_int = '%-20s %d\n' fmt_str_str = '%-20s %s\n' f.write(fmt_str_str % ('bc', G.bc)) f.write(fmt_str_float % ('Cm', G.Cm)) f.write(fmt_str_float % ('Cg', G.Cg)) ...
# MAIN DUMMYMODE = False # False for gaze contingent display, True for dummy mode (using mouse or joystick) LOGFILENAME = 'testing' # logfilename, without path LOGFILE = LOGFILENAME[:] # .txt; adding path before logfilename is optional; logs responses (NOT eye movements, these are stored in an EDF file!) TRIALS = 10...
dummymode = False logfilename = 'testing' logfile = LOGFILENAME[:] trials = 10 screennr = 0 disptype = 'psychopy' dispsize = (1024, 768) screensize = (73, 33) screendist = 124.5 mousevisible = True fullscreen = True bgc = (125, 125, 125) fgc = (0, 0, 0) mousebuttonlist = None mousetimeout = None keylist = None keytimeo...
# 11/15 if __name__ == "__main__": f = open("../data.txt", "r") lines = f.readlines() width = int(lines[0]) length = int(lines[1]) room = tuple(tuple(map(int, lines[_ + 2].split())) for _ in range(width)) else: width = int(input()) length = int(input()) room = tuple(tuple(map(int, inp...
if __name__ == '__main__': f = open('../data.txt', 'r') lines = f.readlines() width = int(lines[0]) length = int(lines[1]) room = tuple((tuple(map(int, lines[_ + 2].split())) for _ in range(width))) else: width = int(input()) length = int(input()) room = tuple((tuple(map(int, input().spl...
# Lecture 2.6, slide 6 x = int(raw_input('Enter an integer: ')) # Asks the user for a number x. y = int(raw_input('Enter an integer: ')) # Asks the user for a number y. z = int(raw_input('Enter an integer: ')) # Asks the user for a number z. if (x < y and x < z): print ('x is least') elif (y < z): print ('y i...
x = int(raw_input('Enter an integer: ')) y = int(raw_input('Enter an integer: ')) z = int(raw_input('Enter an integer: ')) if x < y and x < z: print('x is least') elif y < z: print('y is least') else: print('z is least')
#!/usr/bin/python # -*- coding: UTF-8 -*- PIXIVUTIL_VERSION = '20130912' PIXIVUTIL_LINK = 'https://nandaka.wordpress.com/tag/pixiv-downloader/' PIXIV_URL = 'http://www.pixiv.net' PIXIV_URL_SSL = 'https://ssl.pixiv.net/login.php' PIXIV_CSS_LIST_ID = 'display_works' PIXIV_CSS_PROFILE_NAME_CLASS = 'f18b' PIXIV_CSS_IMAGE_...
pixivutil_version = '20130912' pixivutil_link = 'https://nandaka.wordpress.com/tag/pixiv-downloader/' pixiv_url = 'http://www.pixiv.net' pixiv_url_ssl = 'https://ssl.pixiv.net/login.php' pixiv_css_list_id = 'display_works' pixiv_css_profile_name_class = 'f18b' pixiv_css_image_title_class = 'works_data' pixiv_css_tags_i...
# Below you can see the class Task. Any task has a # description and a person for finishing this # task. In our class, these aspects are represented by # instance attributes description and team. # Sometimes we may want to combine tasks together # (that is, add them up). Define the method __add__ that: # - combines t...
class Task: def __init__(self, description, team): self.description = description self.team = team def __add__(self, other): return task(f'{self.description}\n{other.description}', f'{self.team}, {other.team}') task1 = task('Finish the assignment.', 'Kate') task2 = task('Prepare the pr...
def bestSum(targetSum, numbers, dict1): if targetSum in dict1: return dict1[targetSum] if targetSum == 0: return [] if targetSum <= 0: return None shortestCombination = None for i in numbers: remainderSum = targetSum-i combination = bestSum(remainderSum, numb...
def best_sum(targetSum, numbers, dict1): if targetSum in dict1: return dict1[targetSum] if targetSum == 0: return [] if targetSum <= 0: return None shortest_combination = None for i in numbers: remainder_sum = targetSum - i combination = best_sum(remainderSum,...
meta = dict( name='nginx', )
meta = dict(name='nginx')
load("//tools:build_rules/doc.bzl", "asciidoc") def asciidoc_with_verifier(name, src): asciidoc( name = name, src = src, confs = [ "kythe-filter.conf", ], data = [ "example.sh", "example-clike.sh", "example-cxx.sh", "example-dot.sh", "example-java.s...
load('//tools:build_rules/doc.bzl', 'asciidoc') def asciidoc_with_verifier(name, src): asciidoc(name=name, src=src, confs=['kythe-filter.conf'], data=['example.sh', 'example-clike.sh', 'example-cxx.sh', 'example-dot.sh', 'example-java.sh', 'java-schema-file-data-template.FileData', 'java-schema-unit-template.Compi...
# Colleen is turning n years old! Therefore, she has n candles # of various heights on her cake, and candle i has height height. # Because the taller candles tower over the shorter ones, # Colleen can only blow out the tallest candles. # Given the height for each individual candle, find and print the # number of c...
def birthday_cake_candles(n, ar): max_number = max(ar) candles = [] for i in range(n): if max_number == ar[i]: candles.append(ar[i]) return len(candles) n = int(input().strip()) ar = list(map(int, input().strip().split(' '))) result = birthday_cake_candles(n, ar) print(result)
class Circle: def __init__(self, radius): self.radius = radius def resize(self, factor): self.radius *= factor def __str__(self): return 'A circle of radius %s' % self.radius
class Circle: def __init__(self, radius): self.radius = radius def resize(self, factor): self.radius *= factor def __str__(self): return 'A circle of radius %s' % self.radius
class A: class B(Exception): def __init__(self): pass raise A.B
class A: class B(Exception): def __init__(self): pass raise A.B
# Subset or Subsequence generation # Input - "abc", Output - "a", "b", "c", "ab", "ac", "abc", "bc" # Input - "abcd", Output - "a", "b", "c", "d", "ab", "ac", "ad", "abc", "acd", "abd", "abcd", "bc", "bcd", "bd", "cd" # "abc" "ab" "ac" "a" "bc" "b" "c" "" # \ / \ / \ / \ / # "ab" "a" "b"...
def subset(s, index=0, curr=''): if index == len(s): print(curr, end=' ') return subset(s, index + 1, curr + s[index]) subset(s, index + 1, curr) subset('abc') print() subset('abcd') print()
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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 # # THIS SOFTWARE IS PRO...
def get_reset_pc(): return 2147483648 def get_initial_pc(thread_id): return get_base_initial_pc() + thread_id * get_initial_pc_offset() def get_boot_pc(thread_id): return get_base_boot_pc() + thread_id * get_boot_pc_offset() def get_reset_region_size(): return 64 def get_boot_region_size(): retu...
class MaxHeap: def __init__(self): self.heap_list = [None] self.count = 0 # HEAP HELPER METHODS # DO NOT CHANGE! def parent_idx(self, idx): return idx // 2 def left_child_idx(self, idx): return idx * 2 def right_child_idx(self, idx): return idx * 2 + 1 # END OF HEAP HELPER METHODS ...
class Maxheap: def __init__(self): self.heap_list = [None] self.count = 0 def parent_idx(self, idx): return idx // 2 def left_child_idx(self, idx): return idx * 2 def right_child_idx(self, idx): return idx * 2 + 1 def add(self, element): self.coun...
n = int(input()) check = 0 while n: n -= 1 m, c = [int(x) for x in input().split()] hash = {str(x) : [] for x in range(m)} entrada = [int(x) for x in input().split()] if check: print() for i in entrada: resto = i % m hash[str(resto)].append(int(i)) for i in hash: ...
n = int(input()) check = 0 while n: n -= 1 (m, c) = [int(x) for x in input().split()] hash = {str(x): [] for x in range(m)} entrada = [int(x) for x in input().split()] if check: print() for i in entrada: resto = i % m hash[str(resto)].append(int(i)) for i in hash: ...
# Ref: not522/ac-library-python https://github.com/not522/ac-library-python/blob/master/atcoder/dsu.py class UnionFind: def __init__(self, n=0): self._n = n self.parent_or_size = [-1] * n def merge(self, a, b): assert 0 <= a < self._n assert 0 <= b < self._n x = self.fin...
class Unionfind: def __init__(self, n=0): self._n = n self.parent_or_size = [-1] * n def merge(self, a, b): assert 0 <= a < self._n assert 0 <= b < self._n x = self.find(a) y = self.find(b) if x == y: return x if -self.parent_or_size[...
# @author: https://github.com/luis2ra from https://www.w3schools.com/python/python_syntax.asp ''' Python Indentation Indentation refers to the spaces at the beginning of a code line. Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Pyt...
""" Python Indentation Indentation refers to the spaces at the beginning of a code line. Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important. Python uses indentation to indicate a block of code. """ if 5 > 2: print('Five is greater tha...
expected_output = { "slot": { "lc": { "0/0": { "name": "NCS1K4-OTN-XP", "full_slot": "0/0", "state": "POWERED_ON", "config_state": "NSHUT", }, "0/1": { "name": "NCS1K4-1.2T-K9", ...
expected_output = {'slot': {'lc': {'0/0': {'name': 'NCS1K4-OTN-XP', 'full_slot': '0/0', 'state': 'POWERED_ON', 'config_state': 'NSHUT'}, '0/1': {'name': 'NCS1K4-1.2T-K9', 'full_slot': '0/1', 'state': 'OPERATIONAL', 'config_state': 'NSHUT'}, '0/3': {'name': 'NCS1K4-OTN-XPL', 'full_slot': '0/3', 'state': 'OPERATIONAL', '...
#%% with open("data/input1.txt", 'r') as f: data_list = [int(line) for line in f.readlines()] # %% number_of_increases = 0 for i in range(len(data_list)-1): if data_list[i] < data_list[i+1]: number_of_increases += 1 print(number_of_increases) # %% result2 = 0 for i in range(len(data_list)-3): if s...
with open('data/input1.txt', 'r') as f: data_list = [int(line) for line in f.readlines()] number_of_increases = 0 for i in range(len(data_list) - 1): if data_list[i] < data_list[i + 1]: number_of_increases += 1 print(number_of_increases) result2 = 0 for i in range(len(data_list) - 3): if sum(data_li...
# couldn't find a better name for this module, feel free to change random_addresses = ["0x62D4c04644314F35868Ba4c65cc27a77681dE7a9", "0x473319898464Ca640Af692A0534175981AB78Aa1", "0x5B8D43FfdE4a2982B9A5387cDF21D54Ead64Ac8d", "0x41f615E24fAbd2b097a320E9E6c1f448cb40521c", "0x9aeFBE0b3C3ba9Eab262CB9856E8157AB7648e09", "0...
random_addresses = ['0x62D4c04644314F35868Ba4c65cc27a77681dE7a9', '0x473319898464Ca640Af692A0534175981AB78Aa1', '0x5B8D43FfdE4a2982B9A5387cDF21D54Ead64Ac8d', '0x41f615E24fAbd2b097a320E9E6c1f448cb40521c', '0x9aeFBE0b3C3ba9Eab262CB9856E8157AB7648e09', '0x08f5a9235B08173b7569F83645d2c7fB55e8cCD8', '0x08fd34559F2ed8585d381...
# # PySNMP MIB module SONUS-ANNOUNCEMENT-RESOURCES-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SONUS-ANNOUNCEMENT-RESOURCES-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:09:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Pyt...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ...
def key_decrypt(key, cipher): key = bytes.fromhex(key) cipher = bytes.fromhex(cipher) return bytes([k ^ c for c, k in zip(key, cipher)]).hex() # constants k1 = 'a6c8b6733c9b22de7bc0253266a3867df55acde8635e19c73313' k12 = '37dcb292030faa90d07eec17e3b1c6d8daf94c35d4c9191a5e1e' k23 = 'c1545756687e7573db23...
def key_decrypt(key, cipher): key = bytes.fromhex(key) cipher = bytes.fromhex(cipher) return bytes([k ^ c for (c, k) in zip(key, cipher)]).hex() k1 = 'a6c8b6733c9b22de7bc0253266a3867df55acde8635e19c73313' k12 = '37dcb292030faa90d07eec17e3b1c6d8daf94c35d4c9191a5e1e' k23 = 'c1545756687e7573db23aa1c3452a098b71...
# Time complexity: O(n*n) # Approach: Mathematical solution for directly finding kth sequence (https://www.youtube.com/watch?v=wT7gcXLYoao). class Solution: def calcFact(self, n): fact = [1] prod = 1 for i in range(1, n+1): prod *= i fact.append(prod) return ...
class Solution: def calc_fact(self, n): fact = [1] prod = 1 for i in range(1, n + 1): prod *= i fact.append(prod) return fact def get_permutation(self, n: int, k: int) -> str: k -= 1 st = set() fact = self.calcFact(n) (pre...
def brooke4(): i01.head.rothead.enable() i01.head.neck.enable() lookrightside() sleep(4) lookleftside() sleep(4) lookinmiddle() sleep(4) lookrightside() sleep(4) lookleftside() sleep(4) lookinmiddle() sleep(4) i01.disable() sleep(20) brooke2()
def brooke4(): i01.head.rothead.enable() i01.head.neck.enable() lookrightside() sleep(4) lookleftside() sleep(4) lookinmiddle() sleep(4) lookrightside() sleep(4) lookleftside() sleep(4) lookinmiddle() sleep(4) i01.disable() sleep(20) brooke2()
class Empty: def __repr__(self): return "<Empty>" class Object(object): def __init__(self, attributes: dict): for key, value in attributes.items(): setattr(self, key, value) class Array(list): def __init__(self, *args): super().__init__(args) @property def le...
class Empty: def __repr__(self): return '<Empty>' class Object(object): def __init__(self, attributes: dict): for (key, value) in attributes.items(): setattr(self, key, value) class Array(list): def __init__(self, *args): super().__init__(args) @property def...
def str2label(strs, max_len): def ascii_val2label(ascii_val): if ascii_val >= 48 and ascii_val <= 57: # '0'-'9' are mapped to 1-10 label = ascii_val - 47 elif ascii_val >= 65 and ascii_val <= 90: # 'A'-'Z' are mapped to 11-36 label = ascii_val - 64 + 10 elif ascii_val >= 97 and ascii_val <= 122: # 'a'...
def str2label(strs, max_len): def ascii_val2label(ascii_val): if ascii_val >= 48 and ascii_val <= 57: label = ascii_val - 47 elif ascii_val >= 65 and ascii_val <= 90: label = ascii_val - 64 + 10 elif ascii_val >= 97 and ascii_val <= 122: label = ascii_val...
def sieve(n): a = [True] * n for i in range(2, int(n ** 0.5)): if a[i]: for j in range(i ** 2, n, i): a[j] = False return [i for i in range(len(a)) if a[i] and i > 1] if __name__ == '__main__': print(sum(sieve(2000000)))
def sieve(n): a = [True] * n for i in range(2, int(n ** 0.5)): if a[i]: for j in range(i ** 2, n, i): a[j] = False return [i for i in range(len(a)) if a[i] and i > 1] if __name__ == '__main__': print(sum(sieve(2000000)))
colors = {"Red", "Green", "Blue"} print(type(colors), colors) print("Red" in colors) colors.add("Violet") colors.remove("Red") print(colors)
colors = {'Red', 'Green', 'Blue'} print(type(colors), colors) print('Red' in colors) colors.add('Violet') colors.remove('Red') print(colors)
class Preferences(): def __init__(self): self.scaling = None self.block_size = None self.screen_width = 800 self.screen_height = 600
class Preferences: def __init__(self): self.scaling = None self.block_size = None self.screen_width = 800 self.screen_height = 600
# Data class for artifact stats class ArtifactStats: level = 20 # TODO: Sanity check lists for sum values or somehow otherwise refactor def __init__(self): self.sandsChoice = [1, 0] self.cupChoice = [1, 0, 0, 0] self.helmChoice = [1, 0, 0, 0] self.sandsHP = 0 self.s...
class Artifactstats: level = 20 def __init__(self): self.sandsChoice = [1, 0] self.cupChoice = [1, 0, 0, 0] self.helmChoice = [1, 0, 0, 0] self.sandsHP = 0 self.sandsATK = 0 self.cupHP = 0 self.cupATK = 0 self.cupPHYS = 0 self.cupGEO = 0 ...
class Config: FIELDS_TO_BE_STORED = ["ogc_fid", "znacka"] ENCODING = "utf-8" FILENAME_BASE = "Situation_" STORE_PATH = "c:/temp/" JSON_EXTENSION = ".json" FEATURE_CLASS_KEY = "feature_class" config = Config()
class Config: fields_to_be_stored = ['ogc_fid', 'znacka'] encoding = 'utf-8' filename_base = 'Situation_' store_path = 'c:/temp/' json_extension = '.json' feature_class_key = 'feature_class' config = config()
scores = input("Type list of scores: ").split() for i in range(0, len(scores)): scores[i] = int(scores[i]) if len(scores) > 1: max_score = scores[0] for score in scores: if score > max_score: max_score = score print(f"Max value is: {max_score}") else: print("Score list is empty")
scores = input('Type list of scores: ').split() for i in range(0, len(scores)): scores[i] = int(scores[i]) if len(scores) > 1: max_score = scores[0] for score in scores: if score > max_score: max_score = score print(f'Max value is: {max_score}') else: print('Score list is empty')
if __name__ == '__main__': n = int(input()) a = 1 for i in range(2,n+1): if(i in range(0,10)): a = a*10 + i elif(i in range(10,100)): a = a*100 + i elif(i in range(100,1000)): a = a*1000 + i elif(i in range(1000, 10000)): a = a*...
if __name__ == '__main__': n = int(input()) a = 1 for i in range(2, n + 1): if i in range(0, 10): a = a * 10 + i elif i in range(10, 100): a = a * 100 + i elif i in range(100, 1000): a = a * 1000 + i elif i in range(1000, 10000): ...
#Addition a=12 b=33 c=a+b print(c)
a = 12 b = 33 c = a + b print(c)
#Converts seconts to HMS format sec = int(input("Seconts: ")) h = sec / 3600 m = (sec - h*3600) / 60 s = sec - h*3600 - m*60 print (h,':',m,':',s)
sec = int(input('Seconts: ')) h = sec / 3600 m = (sec - h * 3600) / 60 s = sec - h * 3600 - m * 60 print(h, ':', m, ':', s)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # The master toctree document. master_doc = 'index' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': 'a4paper', } # The name of an image file (relative to this di...
master_doc = 'index' latex_elements = {'papersize': 'a4paper'} latex_logo = 'media/agid-logo.png' latex_show_pagerefs = False latex_show_urls = False latex_appendices = ['attachments/allegato-a-guida-alla-pubblicazione-open-source-di-software-realizzato-per-la-pa', 'attachments/allegato-b-guida-alla-manutenzione-di-sof...
''' Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example 1: Input: head = [1,2,6,3,4,5,6], val = 6 Output: [1,2,3,4,5] Example 2: Input: head = [], val = 1 Output: [] Example 3: Input: head = [7,7,7,7], val = 7 Output...
""" Given the head of a linked list and an integer val, remove all the nodes of the linked list that has Node.val == val, and return the new head. Example 1: Input: head = [1,2,6,3,4,5,6], val = 6 Output: [1,2,3,4,5] Example 2: Input: head = [], val = 1 Output: [] Example 3: Input: head = [7,7,7,7], val = 7 Output...
# Python - 3.6.0 Test.describe('Basic tests') Test.assert_equals(greet('english'), 'Welcome') Test.assert_equals(greet('dutch'), 'Welkom') Test.assert_equals(greet('IP_ADDRESS_INVALID'), 'Welcome') Test.assert_equals(greet(''), 'Welcome') Test.assert_equals(greet(2), 'Welcome')
Test.describe('Basic tests') Test.assert_equals(greet('english'), 'Welcome') Test.assert_equals(greet('dutch'), 'Welkom') Test.assert_equals(greet('IP_ADDRESS_INVALID'), 'Welcome') Test.assert_equals(greet(''), 'Welcome') Test.assert_equals(greet(2), 'Welcome')
def capital_indexes(string): list = enumerate(string) capital = [] for count, item in list: if item.isupper(): capital.append(count) return capital
def capital_indexes(string): list = enumerate(string) capital = [] for (count, item) in list: if item.isupper(): capital.append(count) return capital
n = int(input()) a = input().split() for i in range(n): print(a[n - i - 1], end="") if i < n - 1: print(" ", end="") print()
n = int(input()) a = input().split() for i in range(n): print(a[n - i - 1], end='') if i < n - 1: print(' ', end='') print()
#begin Stopwatch.zeroTimer() while Stopwatch.getSinceLastZeroed() < 20: Stopwatch.Wait(0.1) Line.Measure() datagram.add_data() DataStore.writeData() DataStore.writeSeparator() #end
Stopwatch.zeroTimer() while Stopwatch.getSinceLastZeroed() < 20: Stopwatch.Wait(0.1) Line.Measure() datagram.add_data() DataStore.writeData() DataStore.writeSeparator()
def test_valid_crentials_login(desktop_web_driver): desktop_web_driver.get('https://www.saucedemo.com/v1') desktop_web_driver.find_element_by_id('user-name').send_keys('standard_user') desktop_web_driver.find_element_by_id('password').send_keys('secret_sauce') desktop_web_driver.find_element_by_css_sel...
def test_valid_crentials_login(desktop_web_driver): desktop_web_driver.get('https://www.saucedemo.com/v1') desktop_web_driver.find_element_by_id('user-name').send_keys('standard_user') desktop_web_driver.find_element_by_id('password').send_keys('secret_sauce') desktop_web_driver.find_element_by_css_sele...
CURRENT_FORMAT_VERSION = 20 SUPPORTED_VERSIONS = (17, 18, 19, 20) faction_mapping = { 0: 'DE', 1: 'FR', 2: 'IO', 3: 'NX', 4: 'PZ', 5: 'SI', 6: 'BW', 7: 'SH', 9: 'MT', 10: 'BC', 'DE': 0, 'FR': 1, 'IO': 2, 'NX': 3, 'PZ': 4, 'SI': 5, 'BW': 6, 'SH': 7,...
current_format_version = 20 supported_versions = (17, 18, 19, 20) faction_mapping = {0: 'DE', 1: 'FR', 2: 'IO', 3: 'NX', 4: 'PZ', 5: 'SI', 6: 'BW', 7: 'SH', 9: 'MT', 10: 'BC', 'DE': 0, 'FR': 1, 'IO': 2, 'NX': 3, 'PZ': 4, 'SI': 5, 'BW': 6, 'SH': 7, 'MT': 9, 'BC': 10}
class Solution: def binaryTreePaths(self, root: TreeNode) -> List[str]: ans, path = [], [] def dfs(root): if not root: return path.append(root.val) if not root.left and not root.right: ans.append('->'.join(str(x) for x in path)) path.pop() return dfs(root.left) ...
class Solution: def binary_tree_paths(self, root: TreeNode) -> List[str]: (ans, path) = ([], []) def dfs(root): if not root: return path.append(root.val) if not root.left and (not root.right): ans.append('->'.join((str(x) for x in...
class Solution: def rob(self, nums: List[int]) -> int: dp1, dp2 = 0, 0 for num in nums: dp1, dp2 = dp2, max(dp1 + num, dp2) return dp2
class Solution: def rob(self, nums: List[int]) -> int: (dp1, dp2) = (0, 0) for num in nums: (dp1, dp2) = (dp2, max(dp1 + num, dp2)) return dp2
def foo(a, b): print(a) print(b) return a + b foo()
def foo(a, b): print(a) print(b) return a + b foo()
def part1(input, preamble) -> int: possibleSums = [] i = 0 j = 0 while i < preamble: for k in range(1, preamble): possibleSums.append(input[i] + input[k]) i += 1 while input[i] in possibleSums and i < len(input): possibleSums = possibleSums[preamble-1:] j ...
def part1(input, preamble) -> int: possible_sums = [] i = 0 j = 0 while i < preamble: for k in range(1, preamble): possibleSums.append(input[i] + input[k]) i += 1 while input[i] in possibleSums and i < len(input): possible_sums = possibleSums[preamble - 1:] ...
c = get_config() c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.open_browser = False c.NotebookApp.port = 8889 c.NotebookApp.token = ''
c = get_config() c.NotebookApp.ip = '0.0.0.0' c.NotebookApp.open_browser = False c.NotebookApp.port = 8889 c.NotebookApp.token = ''