content
stringlengths
7
1.05M
fixed_cases
stringlengths
1
1.28M
SECRET_KEY = '123' # # For mysql in python3.5, uncomment if you will Use MySQL database driver # import pymysql # pymysql.install_as_MySQLdb() DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3', } } KB_NAME_FILE_PATH = '/home/g10k/git/knowledge_base/kb_li...
secret_key = '123' databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3'}} kb_name_file_path = '/home/g10k/git/knowledge_base/kb_links.json'
class Solution: def isDividingNumber(self, num): if '0' in str(num): return False return 0 == sum(num % int(i) for i in str(num)) def selfDividingNumbers(self, left: int, right: int) -> List[int]: divlist = [] for i in range(left, right + 1, +1): if self....
class Solution: def is_dividing_number(self, num): if '0' in str(num): return False return 0 == sum((num % int(i) for i in str(num))) def self_dividing_numbers(self, left: int, right: int) -> List[int]: divlist = [] for i in range(left, right + 1, +1): i...
"""Pyvista specific errors.""" CAMERA_ERROR_MESSAGE = """Invalid camera description Camera description must be one of the following: Iterable containing position, focal_point, and view up. For example: [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)] Iterable containing a view vector. For example: [-1.0, 2.0...
"""Pyvista specific errors.""" camera_error_message = "Invalid camera description\nCamera description must be one of the following:\n\nIterable containing position, focal_point, and view up. For example:\n[(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)]\n\nIterable containing a view vector. For example:\n[-1.0,...
class InvalidIPv4Address(Exception): """ Exception raised for invalid IPv4 addresses. Attributes: ipv4: IPv4 address that triggered the error. msg : Explanation of the error. """ def __init__(self, ipv4, msg="Invalid IPv4 Address"): self.ipv4 = ipv4 self.msg ...
class Invalidipv4Address(Exception): """ Exception raised for invalid IPv4 addresses. Attributes: ipv4: IPv4 address that triggered the error. msg : Explanation of the error. """ def __init__(self, ipv4, msg='Invalid IPv4 Address'): self.ipv4 = ipv4 self.msg = msg ...
# coding:utf-8 ''' @author = super_fazai @File : __init__.py.py @Time : 2016/12/13 15:39 @connect : superonesfazai@gmail.com '''
""" @author = super_fazai @File : __init__.py.py @Time : 2016/12/13 15:39 @connect : superonesfazai@gmail.com """
class Manager: def __init__(self): self.states = [] def process_input(self, event): self.states[-1].process_input(event) def update(self): self.states[-1].update() def draw(self, screen): for state in self.states: state.draw(screen) def push(self, stat...
class Manager: def __init__(self): self.states = [] def process_input(self, event): self.states[-1].process_input(event) def update(self): self.states[-1].update() def draw(self, screen): for state in self.states: state.draw(screen) def push(self, sta...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio """ # Built-in modules # ################################################################################ def add_dummy_scores(iterable, score=0): """Add zero scores to all sequences.""" fo...
""" Written by Lucas Sinclair. MIT Licensed. Contact at www.sinclair.bio """ def add_dummy_scores(iterable, score=0): """Add zero scores to all sequences.""" for seq in iterable: seq.letter_annotations['phred_quality'] = (score,) * len(seq) yield seq
# # Formatting # x = 12 if x == 24: print('Is valid') else: print("Not valid") def helper(name='sample'): pass def another(name = 'sample'): pass msg = "abc" msg2 = 'abc' print(msg) def print_hello(name) : """ Greets the user by name Parameters: name (str): The name of the user Returns: st...
x = 12 if x == 24: print('Is valid') else: print('Not valid') def helper(name='sample'): pass def another(name='sample'): pass msg = 'abc' msg2 = 'abc' print(msg) def print_hello(name): """ Greets the user by name Parameters: name (str): The name of the user Returns: str: The greeting ...
#!/usr/bin/env python class Real(object): def method(self): return "method" @property def prop(self): # print "prop called" return "prop" class PropertyProxy(object): def __init__( self, object, name ): self._object = object self._name = name def __get__(sel...
class Real(object): def method(self): return 'method' @property def prop(self): return 'prop' class Propertyproxy(object): def __init__(self, object, name): self._object = object self._name = name def __get__(self, obj, type): return obj.__getattribute__(...
#!/usr/bin/python # -*- coding:utf-8 -*- #Filename: print_index.py colors = [ 'red', 'green', 'blue', 'yellow' ] for i in range(len(colors)): print (i, '->', colors[i]) # >>> 0 -> red # 1 -> green # 2 -> blue # 3 -> yellow # >>> for i, color in enumerate(colors): print (i, '->', color)...
colors = ['red', 'green', 'blue', 'yellow'] for i in range(len(colors)): print(i, '->', colors[i]) for (i, color) in enumerate(colors): print(i, '->', color)
class Cluster(object): """ Base Cluster class. This is intended to be a generic interface to different types of clusters. Clusters could be Kubernetes clusters, Docker swarms, or cloud compute/container services. """ def deploy_flow(self, name=None): """ Deploys a flow to the cl...
class Cluster(object): """ Base Cluster class. This is intended to be a generic interface to different types of clusters. Clusters could be Kubernetes clusters, Docker swarms, or cloud compute/container services. """ def deploy_flow(self, name=None): """ Deploys a flow to the cl...
set_A = set(map(int,input().split())) N = int(input()) for i in range(N): arr_A = set(input().split()) arr_N = set(input().split()) if not arr_A.issuperset(arr_N): print(False) else: print(True)
set_a = set(map(int, input().split())) n = int(input()) for i in range(N): arr_a = set(input().split()) arr_n = set(input().split()) if not arr_A.issuperset(arr_N): print(False) else: print(True)
def main(): a = "Java" b = a.replace("a", "ao") print(b) c = a.replace("a", "") print(c) print(b[1:3]) d = a[0] + b[5] print("PRINTS D: " + d) e = 3 * len(a) print("prints e: " + str(e)) print(d + "k" + "e") print(a[2]) main()
def main(): a = 'Java' b = a.replace('a', 'ao') print(b) c = a.replace('a', '') print(c) print(b[1:3]) d = a[0] + b[5] print('PRINTS D: ' + d) e = 3 * len(a) print('prints e: ' + str(e)) print(d + 'k' + 'e') print(a[2]) main()
#Your Own list. List_of_transportation = ["car","bike","truck"] print("I just love to ride a "+List_of_transportation[1]+".") print("But i also love to sit in a "+List_of_transportation[0]+" comfortably and drive.") print("I also play simulator games of "+List_of_transportation[2]+".")
list_of_transportation = ['car', 'bike', 'truck'] print('I just love to ride a ' + List_of_transportation[1] + '.') print('But i also love to sit in a ' + List_of_transportation[0] + ' comfortably and drive.') print('I also play simulator games of ' + List_of_transportation[2] + '.')
# Copyright 2017 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...
"""Install toolchain dependencies""" load('@build_bazel_rules_nodejs//:defs.bzl', 'check_bazel_version', 'check_rules_nodejs_version', 'yarn_install') load('@bazel_gazelle//:deps.bzl', 'go_repository') def ts_setup_workspace(): """This repository rule should be called from your WORKSPACE file. It creates some...
supported_languages = { # .c,.h: C "c": "C", "h": "C", # .cc .cpp .cxx .c++ .h .hh : CPP "cc": "CPP", "cpp": "CPP", "cxx": "CPP", "c++": "CPP", "h": "CPP", "hh": "CPP", # .py .pyw, .pyc, .pyo, .pyd : PYTHON "py": "PYTHON", "pyw": "PYTHON", "pyc": "PYTHON", "py...
supported_languages = {'c': 'C', 'h': 'C', 'cc': 'CPP', 'cpp': 'CPP', 'cxx': 'CPP', 'c++': 'CPP', 'h': 'CPP', 'hh': 'CPP', 'py': 'PYTHON', 'pyw': 'PYTHON', 'pyc': 'PYTHON', 'pyo': 'PYTHON', 'pyd': 'PYTHON', 'clj': 'CLOJURE', 'edn': 'CLOJURE', 'js': 'JAVASCRIPT', 'java': 'JAVA', 'class': 'JAVA', 'jar': 'JAVA', 'rb': 'RU...
####################### # Dennis MUD # # break_item.py # # Copyright 2018-2020 # # Michael D. Reiley # ####################### # ********** # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal i...
name = 'break item' categories = ['items'] aliases = ['delete item', 'destroy item', 'remove item'] usage = 'break item <item_id>' description = 'Break the item in your inventory with ID <item_id>.\n\nYou must own the item and it must be in your inventory in order to break it.\nWizards can break any item from anywhere....
def buildPalindrome(st): if st == st[::-1]: # Check for initial palindrome return st index = 0 subStr = st[index:] while subStr != subStr[::-1]: # while substring is not a palindrome index += 1 subStr = st[index:] return st + st[index - 1 :: -1]
def build_palindrome(st): if st == st[::-1]: return st index = 0 sub_str = st[index:] while subStr != subStr[::-1]: index += 1 sub_str = st[index:] return st + st[index - 1::-1]
class node: def __init__(self, ID, log): self.ID = ID self.log = log self.peers = list() class ISP(node): def __init__(self, ID, log): super().__init__(ID, log) self.type = 'ISP' def print(self): print(self.ID, self.log, self.peers, self.type) class butt(...
class Node: def __init__(self, ID, log): self.ID = ID self.log = log self.peers = list() class Isp(node): def __init__(self, ID, log): super().__init__(ID, log) self.type = 'ISP' def print(self): print(self.ID, self.log, self.peers, self.type) class Butt(...
__all__ = [ "gen_init_string" , "gen_function_declaration_string" , "gen_array_declaration" ] def gen_init_string(_type, initializer, indent): init_code = "" if initializer is not None: raw_code = _type.gen_usage_string(initializer) # add indent to initializer code init_code_l...
__all__ = ['gen_init_string', 'gen_function_declaration_string', 'gen_array_declaration'] def gen_init_string(_type, initializer, indent): init_code = '' if initializer is not None: raw_code = _type.gen_usage_string(initializer) init_code_lines = raw_code.split('\n') init_code = '@b=@b'...
with open("data/iris.csv") as f: for line in f: print (line.split(',')[:4])
with open('data/iris.csv') as f: for line in f: print(line.split(',')[:4])
""" Question 6 Write a function that will copy the contents of one file to a new file. """ def copy_file(infile, outfile): with open(infile) as file: with open(outfile, 'w') as new_file: new_file.write(file.read()) copy_file('capitals.txt', 'new_capitals.txt')
""" Question 6 Write a function that will copy the contents of one file to a new file. """ def copy_file(infile, outfile): with open(infile) as file: with open(outfile, 'w') as new_file: new_file.write(file.read()) copy_file('capitals.txt', 'new_capitals.txt')
"""A mocked database module.""" class DatabaseMongoCollectionMock: """The mocked database mongo class.""" def __init__(self, config): """Start the class.""" self.config = config self.dummy_doc = {} self.valid_response = {"_id": 123, "key": "456", "value": "789"} async def...
"""A mocked database module.""" class Databasemongocollectionmock: """The mocked database mongo class.""" def __init__(self, config): """Start the class.""" self.config = config self.dummy_doc = {} self.valid_response = {'_id': 123, 'key': '456', 'value': '789'} async def ...
n, m = map(int, input().split()) s = input().split() t = input().split() q = int(input()) for _ in range(q): y = int(input()) print(s[(y-1)%len(s)]+t[(y-1)%len(t)])
(n, m) = map(int, input().split()) s = input().split() t = input().split() q = int(input()) for _ in range(q): y = int(input()) print(s[(y - 1) % len(s)] + t[(y - 1) % len(t)])
pkgname = "scdoc" pkgver = "1.11.2" pkgrel = 0 build_style = "makefile" make_cmd = "gmake" hostmakedepends = ["pkgconf", "gmake"] pkgdesc = "Tool for generating roff manual pages" maintainer = "q66 <q66@chimera-linux.org>" license = "MIT" url = "https://git.sr.ht/~sircmpwn/scdoc" source = f"https://git.sr.ht/~sircmpwn/...
pkgname = 'scdoc' pkgver = '1.11.2' pkgrel = 0 build_style = 'makefile' make_cmd = 'gmake' hostmakedepends = ['pkgconf', 'gmake'] pkgdesc = 'Tool for generating roff manual pages' maintainer = 'q66 <q66@chimera-linux.org>' license = 'MIT' url = 'https://git.sr.ht/~sircmpwn/scdoc' source = f'https://git.sr.ht/~sircmpwn/...
"""Base class for file formatters""" __all__ = [ 'BaseFormatter', ] class BaseFormatter: @classmethod def from_file(cls, instr, filename=None, *args, **kwargs): """Reads a game from a file. Args: instr: The input stream. filename: The filename, if any, for tool messag...
"""Base class for file formatters""" __all__ = ['BaseFormatter'] class Baseformatter: @classmethod def from_file(cls, instr, filename=None, *args, **kwargs): """Reads a game from a file. Args: instr: The input stream. filename: The filename, if any, for tool messages. ...
__version__ = "3.2" __author__ = "pyLARDA-dev-team" __doc_link__ = "https://lacros-tropos.github.io/larda-doc/" __init_text__ = f""">> LARDA initialized. Documentation available at {__doc_link__}""" __default_info__ = """ The data from this campaign is provided by larda without warranty and liability. Before publis...
__version__ = '3.2' __author__ = 'pyLARDA-dev-team' __doc_link__ = 'https://lacros-tropos.github.io/larda-doc/' __init_text__ = f'>> LARDA initialized. Documentation available at {__doc_link__}' __default_info__ = "\nThe data from this campaign is provided by larda without warranty and liability.\nBefore publishing che...
# -*- coding: utf-8 -*- ########################################################################## # pySAP - Copyright (C) CEA, 2017 - 2018 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-e...
__exception = Exception class Exception(_Exception): """ Base class for all exceptions in pysap. """ def __init__(self, *args, **kwargs): _Exception.__init__(self, *args, **kwargs) class Sparse2Derror(Exception): """ Base exception type for the package. """ def __init__(self, message...
#Simple calc operations_math = ['+', '-', '*', '/'] print('This is simle calc') try: a = float(input('a = ')) b = float(input('b = ')) choice = input('Please input math operations: +, -, *, / and get result for you') if choice == operations_math[0]: print(a+b) elif choice == operations_math[1]: ...
operations_math = ['+', '-', '*', '/'] print('This is simle calc') try: a = float(input('a = ')) b = float(input('b = ')) choice = input('Please input math operations: +, -, *, / and get result for you') if choice == operations_math[0]: print(a + b) elif choice == operations_math[1]: ...
# -*- coding: utf-8 -*- # UTF-8 encoding when using korean a = int(input()) b = list(map(int, input().split())) maximun = b[0] minimun = b[0] for data in b: if maximun < data: maximun = data if minimun > data: minimun = data if(maximun - minimun + 1 == a): print("YES") else: print("NO")
a = int(input()) b = list(map(int, input().split())) maximun = b[0] minimun = b[0] for data in b: if maximun < data: maximun = data if minimun > data: minimun = data if maximun - minimun + 1 == a: print('YES') else: print('NO')
class Solution: def convertToTitle(self, columnNumber: int) -> str: if columnNumber < 27: return chr(ord('A') - 1 + columnNumber) val = list() columnNumber = columnNumber - 1 while(True): val.append(columnNumber % 26) if (columnNumber < 26): ...
class Solution: def convert_to_title(self, columnNumber: int) -> str: if columnNumber < 27: return chr(ord('A') - 1 + columnNumber) val = list() column_number = columnNumber - 1 while True: val.append(columnNumber % 26) if columnNumber < 26: ...
a = b = source() c = 3 if c: b = source2() sink(b)
a = b = source() c = 3 if c: b = source2() sink(b)
#!/usr/bin/env python # -*- coding: utf-8 -*- def garage(init_arr, final_arr): init_arr = init_arr[::] seqs = 0 seq = [] while init_arr != final_arr: zero = init_arr.index(0) if zero != final_arr.index(0): tmp_val = final_arr[zero] tmp_pos = init_arr.index(tmp_val...
def garage(init_arr, final_arr): init_arr = init_arr[:] seqs = 0 seq = [] while init_arr != final_arr: zero = init_arr.index(0) if zero != final_arr.index(0): tmp_val = final_arr[zero] tmp_pos = init_arr.index(tmp_val) (init_arr[zero], init_arr[tmp_pos...
def test_environment_is_qa(app_config): base_url = app_config.base_url port = app_config.app_port assert base_url == 'https://myqa-env.com' assert port == '80' def test_environment_is_dev(app_config): base_url = app_config.base_url port = app_config.app_port assert base_url == 'https://myd...
def test_environment_is_qa(app_config): base_url = app_config.base_url port = app_config.app_port assert base_url == 'https://myqa-env.com' assert port == '80' def test_environment_is_dev(app_config): base_url = app_config.base_url port = app_config.app_port assert base_url == 'https://myde...
class MyClass: def __init__(self, my_val): self.my_val = my_val my_class = MyClass(1) print(my_class.my_val) print(2) res = 2
class Myclass: def __init__(self, my_val): self.my_val = my_val my_class = my_class(1) print(my_class.my_val) print(2) res = 2
''' This problem was asked by Facebook. Given a binary tree, return all paths from the root to leaves. For example, given the tree: 1 / \ 2 3 / \ 4 5 Return [[1, 2], [1, 3, 4], [1, 3, 5]]. ''' # Definition for a binary tree node class TreeNode: def __init__(self, x, left=None, right=None): ...
""" This problem was asked by Facebook. Given a binary tree, return all paths from the root to leaves. For example, given the tree: 1 / 2 3 / 4 5 Return [[1, 2], [1, 3, 4], [1, 3, 5]]. """ class Treenode: def __init__(self, x, left=None, right=None): self.val = x self.left = le...
def loadPostSample(): posts = [['my','dog','has','flea','problems','help','please'], ['maybe','not','take','him','to','dog','park','stupid'], ['my','dalmation','is','so','cute','I','love','him'], ['stop','posting','stupid','worthless','garbage'], ['mr','licks','at...
def load_post_sample(): posts = [['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'], ['stop', 'posting', 'stupid', 'worthless', 'garbage'], ['mr', 'licks', 'ate', 'my', 'steak', 'how'...
PROVIDER = "S3" KEY = "" SECRET = "" CONTAINER = "yoredis.com" # FOR LOCAL PROVIDER = "LOCAL" CONTAINER = "container_1" CONTAINER2 = "container_2"
provider = 'S3' key = '' secret = '' container = 'yoredis.com' provider = 'LOCAL' container = 'container_1' container2 = 'container_2'
def propagate_go(go_id, parent_set, go_term_dict): if len(go_term_dict[go_id]) == 0: return parent_set for parent in go_term_dict[go_id]: parent_set.add(parent) for parent in go_term_dict[go_id]: propagate_go(parent, parent_set, go_term_dict) return parent_set def form_all_go_pa...
def propagate_go(go_id, parent_set, go_term_dict): if len(go_term_dict[go_id]) == 0: return parent_set for parent in go_term_dict[go_id]: parent_set.add(parent) for parent in go_term_dict[go_id]: propagate_go(parent, parent_set, go_term_dict) return parent_set def form_all_go_pa...
def collide(obj1, obj2): offset_x = obj2.x - obj1.x offset_y = obj2.y - obj1.y return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None
def collide(obj1, obj2): offset_x = obj2.x - obj1.x offset_y = obj2.y - obj1.y return obj1.mask.overlap(obj2.mask, (offset_x, offset_y)) != None
""" 2.1 Remove duplicates from an unsorted linked lists. What if a temporary buffer is not allow? """ # SOLUTION 1 - HASHTABLE # EFFICIENCY # space: O(n) time: O(n) def remove_dups_ht(sll): d = {} c = sll l = sll while c: if c.val in d: l.nxt = c.nxt c = l.nxt ...
""" 2.1 Remove duplicates from an unsorted linked lists. What if a temporary buffer is not allow? """ def remove_dups_ht(sll): d = {} c = sll l = sll while c: if c.val in d: l.nxt = c.nxt c = l.nxt else: d[c.val] = True c = c.nxt ...
L1 = [1, 2, 3, 4] L2 = ['A', 'B', 'C', 'D'] meshtuple = [] for x in L1: for y in L2: meshtuple.append([x, y]) print(meshtuple)
l1 = [1, 2, 3, 4] l2 = ['A', 'B', 'C', 'D'] meshtuple = [] for x in L1: for y in L2: meshtuple.append([x, y]) print(meshtuple)
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 TERM_FILTERS_QUERY = { "bool": { "must": [ { "multi_match": { "query": "mock_feature", "fields": [ "feature_name.raw^25", ...
term_filters_query = {'bool': {'must': [{'multi_match': {'query': 'mock_feature', 'fields': ['feature_name.raw^25', 'feature_name^7', 'feature_group.raw^15', 'feature_group^7', 'version^7', 'description^3', 'status', 'entity', 'tags', 'badges'], 'type': 'cross_fields'}}], 'filter': [{'wildcard': {'badges': 'pii'}}, {'b...
# THEMES # Requires restart # Change the theme variable in config.py to one of these: black = { 'foreground': '#FFFFFF', 'background': '#000000', 'fontshadow': '#010101' } orange = { 'foreground': '#d75f00', 'background': '#303030', 'fontshadow': '#010101' ...
black = {'foreground': '#FFFFFF', 'background': '#000000', 'fontshadow': '#010101'} orange = {'foreground': '#d75f00', 'background': '#303030', 'fontshadow': '#010101'}
""" This code was Ported from CPython's sha512module.c """ SHA_BLOCKSIZE = 128 SHA_DIGESTSIZE = 64 def new_shaobject(): return { "digest": [0] * 8, "count_lo": 0, "count_hi": 0, "data": [0] * SHA_BLOCKSIZE, "local": 0, "digestsize": 0, } ROR64 = ( lambda ...
""" This code was Ported from CPython's sha512module.c """ sha_blocksize = 128 sha_digestsize = 64 def new_shaobject(): return {'digest': [0] * 8, 'count_lo': 0, 'count_hi': 0, 'data': [0] * SHA_BLOCKSIZE, 'local': 0, 'digestsize': 0} ror64 = lambda x, y: ((x & 18446744073709551615) >> (y & 63) | x << 64 - (y & 63...
def exchange(A, i, j): temp = A[i] A[i] = A[j] A[j] = temp return A
def exchange(A, i, j): temp = A[i] A[i] = A[j] A[j] = temp return A
while True: num_items = int(input()) if num_items == 0: break # Normal sort also works # items = list(sorted(map(int, input().split()))) # print(" ".join(map(str, items))) buckets = [0 for i in range(101)] for age in map(int, input().split()): buckets[age] += 1 for i, j in enumerate(bu...
while True: num_items = int(input()) if num_items == 0: break buckets = [0 for i in range(101)] for age in map(int, input().split()): buckets[age] += 1 for (i, j) in enumerate(buckets): if j > 0: if num_items > j: print(' '.join([str(i)] * j), end=...
src =Split(''' aos/board.c aos/board_cli.c aos/st7789.c aos/soc_init.c Src/stm32l4xx_hal_msp.c ''') component =aos_board_component('starterkit', 'stm32l4xx_cube', src) if aos_global_config.compiler == "armcc": component.add_sources('startup_stm32l433xx_keil.s') elif aos_global_config...
src = split('\n aos/board.c\n aos/board_cli.c\n aos/st7789.c\n aos/soc_init.c\n Src/stm32l4xx_hal_msp.c\n') component = aos_board_component('starterkit', 'stm32l4xx_cube', src) if aos_global_config.compiler == 'armcc': component.add_sources('startup_stm32l433xx_keil.s') elif aos_global_config.compile...
return_date = list(map(lambda x: int(x), input().split())) due_date = list(map(lambda x: int(x), input().split())) day = 0 month = 1 year = 2 if return_date[year] > due_date[year]: fine = 10000 elif return_date[year] < due_date[year]: fine = 0 elif return_date[month] > due_date[month]: fine = 500 * (retur...
return_date = list(map(lambda x: int(x), input().split())) due_date = list(map(lambda x: int(x), input().split())) day = 0 month = 1 year = 2 if return_date[year] > due_date[year]: fine = 10000 elif return_date[year] < due_date[year]: fine = 0 elif return_date[month] > due_date[month]: fine = 500 * (return_...
#coding=utf-8 nombre = input("Dime tu nombre: ") edad = int(input("dime tu edad wey: ")) nombre2 = input("dime tu nombre tambien wey: ") edad2 = int(input("y tu edad es?... ")) if (edad>edad2): print ("%s, eres mayor que %s" % (nombre , nombre2)) elif (edad<edad2): print ("%s, eres mayor que %s" % (nombre2 , nomb...
nombre = input('Dime tu nombre: ') edad = int(input('dime tu edad wey: ')) nombre2 = input('dime tu nombre tambien wey: ') edad2 = int(input('y tu edad es?... ')) if edad > edad2: print('%s, eres mayor que %s' % (nombre, nombre2)) elif edad < edad2: print('%s, eres mayor que %s' % (nombre2, nombre)) else: p...
class ChartError(Exception): """Raised whenever we have a generic error trying to draw the chart.""" class NoTicketsProvided(ChartError): """Raised if we provide no tickets to the chart.""" def __init__(self) -> None: super().__init__("No tickets provided. Check your config.")
class Charterror(Exception): """Raised whenever we have a generic error trying to draw the chart.""" class Noticketsprovided(ChartError): """Raised if we provide no tickets to the chart.""" def __init__(self) -> None: super().__init__('No tickets provided. Check your config.')
class SimpleAgg: def __init__(self, query, size=0): self.__size = size self.__query = query def build(self): return { "size": self.__size, "query": { "multi_match": { "query": self.__query, ...
class Simpleagg: def __init__(self, query, size=0): self.__size = size self.__query = query def build(self): return {'size': self.__size, 'query': {'multi_match': {'query': self.__query, 'analyzer': 'english_expander', 'fields': ['name.keyword']}}, 'aggs': {'categ_agg': {'terms': {'fie...
''' The purpose of this directory is to contain files used by multiple platforms, but not by all. (In some cases GTK and Mac impls. can share code, for example.) '''
""" The purpose of this directory is to contain files used by multiple platforms, but not by all. (In some cases GTK and Mac impls. can share code, for example.) """
__all__ = [ "__name__", "__version__", "__author__", "__author_email__", "__description__", "__license__" ] __name__ = "python-fullcontact" __version__ = "3.1.0" __author__ = "FullContact" __author_email__ = "pypy@fullcontact.com" __description__ = "Client library for FullContact V3 Enrich and ...
__all__ = ['__name__', '__version__', '__author__', '__author_email__', '__description__', '__license__'] __name__ = 'python-fullcontact' __version__ = '3.1.0' __author__ = 'FullContact' __author_email__ = 'pypy@fullcontact.com' __description__ = 'Client library for FullContact V3 Enrich and Resolve APIs' __license__ =...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def longestConsecutive(self, root: TreeNode) -> int: ret = 0 def helper(node): nonlocal ret if n...
class Solution: def longest_consecutive(self, root: TreeNode) -> int: ret = 0 def helper(node): nonlocal ret if not node: return (0, 0) (ld, lu) = helper(node.left) (rd, ru) = helper(node.right) (curd, curu) = (1, 1) ...
#!/usr/bin/env python NAME = 'InfoGuard Airlock' def is_waf(self): # credit goes to W3AF return self.matchcookie('^AL[_-]?(SESS|LB)=')
name = 'InfoGuard Airlock' def is_waf(self): return self.matchcookie('^AL[_-]?(SESS|LB)=')
def splitT(l): l = l.split(" ") for i,e in enumerate(l): try: val = int(e) except ValueError: val = e l[i] = val return l def strToTupple(l): return [tuple(splitT(e)) if len(tuple(splitT(e))) != 1 else splitT(e)[0] for e in l] lines = strToTupple(lines) sys.stderr.write(str(lines)) f = lines.pop(0) ...
def split_t(l): l = l.split(' ') for (i, e) in enumerate(l): try: val = int(e) except ValueError: val = e l[i] = val return l def str_to_tupple(l): return [tuple(split_t(e)) if len(tuple(split_t(e))) != 1 else split_t(e)[0] for e in l] lines = str_to_tupp...
class Loss: def __init__(self, name): self.name = name class MeanSquaredError(Loss): """Mean Squared Error """ def __init__(self): super(MeanSquaredError, self).__init__('mean_squared_error') class CategoricalCrossEntropy(Loss): """Categorical Cross-Entropy """ def __in...
class Loss: def __init__(self, name): self.name = name class Meansquarederror(Loss): """Mean Squared Error """ def __init__(self): super(MeanSquaredError, self).__init__('mean_squared_error') class Categoricalcrossentropy(Loss): """Categorical Cross-Entropy """ def __ini...
TAX_RATES = {0 / 100: range(0, 1001), 10 / 100: range(1000, 10001), 15 / 100: range(10000, 20201), 20 / 100: range(20200, 30751), 25 / 100: range(30750, 50001)} # , 30: 50000 def calculate_tax(people_sal): """ Calculate the annual tax :param people_sal: :return: """ ...
tax_rates = {0 / 100: range(0, 1001), 10 / 100: range(1000, 10001), 15 / 100: range(10000, 20201), 20 / 100: range(20200, 30751), 25 / 100: range(30750, 50001)} def calculate_tax(people_sal): """ Calculate the annual tax :param people_sal: :return: """ result = {} for (tax_rate, band) in T...
def shell_sort(arr): sublistcount = len(arr)/2 # While we still have sub lists while sublistcount > 0: for start in range(sublistcount): # Use a gap insertion gap_insertion_sort(arr,start,sublistcount) sublistcount = sublistcount / 2 def ga...
def shell_sort(arr): sublistcount = len(arr) / 2 while sublistcount > 0: for start in range(sublistcount): gap_insertion_sort(arr, start, sublistcount) sublistcount = sublistcount / 2 def gap_insertion_sort(arr, start, gap): for i in range(start + gap, len(arr), gap): cu...
def format_si(number, places=2): number = float(number) if number > 10**9: return ("{0:.%sf} G" % places).format(number / 10**9) if number > 10**6: return ("{0:.%sf} M" % places).format(number / 10**6) if number > 10**3: return ("{0:.%sf} K" % places).format(number / 10**3) ...
def format_si(number, places=2): number = float(number) if number > 10 ** 9: return ('{0:.%sf} G' % places).format(number / 10 ** 9) if number > 10 ** 6: return ('{0:.%sf} M' % places).format(number / 10 ** 6) if number > 10 ** 3: return ('{0:.%sf} K' % places).format(number / 10...
# Module is basically a dumping ground for various menus and help text blurbs the terminal may need. def HelpText(): print(""" ------------------ INFO --------------------- TD Ameritrade API Query Tool Version 0.0.1 Command List: history\t\t: Displays ticker price history candles. ...
def help_text(): print('\n\t\t ------------------ INFO ---------------------\n\t\t TD Ameritrade API Query Tool\n\t Version 0.0.1\n\t\n\t Command List:\n\t history\t\t: Displays ticker price history candles.\n\t query\t\t: Pings the API for specific ticker data.\n\t markethours\t: Gets ma...
def check_user(user, session_type=False): frontend.page( "dashboard", expect={ "script_user": testing.expect.script_user(user) }) if session_type is False: if user.id is None: # Anonymous user. session_type = None else: ses...
def check_user(user, session_type=False): frontend.page('dashboard', expect={'script_user': testing.expect.script_user(user)}) if session_type is False: if user.id is None: session_type = None else: session_type = 'normal' frontend.json('sessions/current', params={'fi...
class Solution: def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ if len(strs) == 0: return '' min_str = strs[0] for s in strs[1:]: if len(s) < len(min_str): min_str = s ...
class Solution: def longest_common_prefix(self, strs): """ :type strs: List[str] :rtype: str """ if len(strs) == 0: return '' min_str = strs[0] for s in strs[1:]: if len(s) < len(min_str): min_str = s common = '...
class Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int """ left = 0 right = len(height)-1 maxarea = 0 while left < right: maxarea = max(maxarea, (right-left) * min(height[right],...
class Solution(object): def max_area(self, height): """ :type height: List[int] :rtype: int """ left = 0 right = len(height) - 1 maxarea = 0 while left < right: maxarea = max(maxarea, (right - left) * min(height[right], height[left])) ...
class Solution: # @param S, a list of integer # @return a list of lists of integer def subsets(self, S): S.sort() return self._subsets(S, len(S)) def _subsets(self, S, k): if k == 0: return [[]] else: res = [[]] for i in range(len(S)):...
class Solution: def subsets(self, S): S.sort() return self._subsets(S, len(S)) def _subsets(self, S, k): if k == 0: return [[]] else: res = [[]] for i in range(len(S)): rest_subsets = self._subsets(S[i + 1:], k - 1) ...
def _exec_hook(hook_name, self): if hasattr(self, hook_name): getattr(self, hook_name)() def hooks(fn): def hooked(self): fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__ _exec_hook('pre_' + fn_name, self) val = fn(self) _exec_hook('post_' + fn_name, ...
def _exec_hook(hook_name, self): if hasattr(self, hook_name): getattr(self, hook_name)() def hooks(fn): def hooked(self): fn_name = fn.func_name if hasattr(fn, 'func_name') else fn.__name__ _exec_hook('pre_' + fn_name, self) val = fn(self) _exec_hook('post_' + fn_name, ...
def print_formatted(number): # your code goes here for i in range(1, number + 1): print('{0:>{w}d} {0:>{w}o} {0:>{w}X} {0:>{w}b}'.format(i, w=len(bin(number)) - 2)) if __name__ == '__main__': n = int(input()) print_formatted(n)
def print_formatted(number): for i in range(1, number + 1): print('{0:>{w}d} {0:>{w}o} {0:>{w}X} {0:>{w}b}'.format(i, w=len(bin(number)) - 2)) if __name__ == '__main__': n = int(input()) print_formatted(n)
# Copyright (c) OpenMMLab. All rights reserved. _base_ = ['./t.py'] base = '_base_.item8' item11 = {{ _base_.item8 }} item12 = {{ _base_.item9 }} item13 = {{ _base_.item10 }} item14 = {{ _base_.item1 }} item15 = dict( a = dict( b = {{ _base_.item2 }} ), b = [{{ _base_.item3 }}], c = [{{ _base_.item4 }}], ...
_base_ = ['./t.py'] base = '_base_.item8' item11 = {{_base_.item8}} item12 = {{_base_.item9}} item13 = {{_base_.item10}} item14 = {{_base_.item1}} item15 = dict(a=dict(b={{_base_.item2}}), b=[{{_base_.item3}}], c=[{{_base_.item4}}], d=[[dict(e={{_base_.item5.a}})], {{_base_.item6}}], e={{_base_.item1}})
""" Stack Min: How would you design a stack which, in addition to push and pop, has a function min which returns the minimum element? Push, pop and min should all operate in 0(1) time. """ class Stack: def __init__(self): self._arr = [] self._min_arr = [] def is_empty(self): return not...
""" Stack Min: How would you design a stack which, in addition to push and pop, has a function min which returns the minimum element? Push, pop and min should all operate in 0(1) time. """ class Stack: def __init__(self): self._arr = [] self._min_arr = [] def is_empty(self): return no...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def recursion(n): if n == 1: return 1 return n + recursion(n - 1) if __name__ == '__main__': n = int(input("Enter n: ")) summary = 0 for i in range(1, n + 1): summary += i print(f"Iterative sum: {summary}") print(f"Recursion ...
def recursion(n): if n == 1: return 1 return n + recursion(n - 1) if __name__ == '__main__': n = int(input('Enter n: ')) summary = 0 for i in range(1, n + 1): summary += i print(f'Iterative sum: {summary}') print(f'Recursion sum: {recursion(n)}')
# # PySNMP MIB module SVRSYS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SVRSYS-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 21:04:40 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:...
(object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer') (named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues') (value_range_constraint, constraints_union, value_size_constraint, constraints_intersection, single_value_constraint) ...
chemin = r'c:\temp\demo.txt' fichier = open(chemin,'r') ligne = fichier.readline() while ligne: print(ligne, end='') ligne = fichier.readline() fichier.close()
chemin = 'c:\\temp\\demo.txt' fichier = open(chemin, 'r') ligne = fichier.readline() while ligne: print(ligne, end='') ligne = fichier.readline() fichier.close()
def index(r): pass def sum(r): pass
def index(r): pass def sum(r): pass
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 13 13:00:03 2018 @author: Khaled Nakhleh """ if __name__ == "__main__": print("\n\tThis file only contains internal functions. Please use main.py to run the program.\n") exit
""" Created on Tue Mar 13 13:00:03 2018 @author: Khaled Nakhleh """ if __name__ == '__main__': print('\n\tThis file only contains internal functions. Please use main.py to run the program.\n') exit
""" Search in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. Your algorithm's runtime complexi...
""" Search in Rotated Sorted Array Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. Your algorithm's runtime complexi...
class Planet: def count_age(self, earth_years, planet): if type(earth_years) is int and type(planet) is str: if earth_years < 0: raise Exception('Wiek nie moze byc ujemny') stala = earth_years / 31557600 if planet == 'Ziemia': return round(...
class Planet: def count_age(self, earth_years, planet): if type(earth_years) is int and type(planet) is str: if earth_years < 0: raise exception('Wiek nie moze byc ujemny') stala = earth_years / 31557600 if planet == 'Ziemia': return round...
imports = ["base.py"] train_option = { "n_train_iteration": 6000, "interval_iter": 2000, } train_artifact_dir = "artifacts/train" evaluate_artifact_dir = "artifacts/evaluate" reference = False model = torch.nn.Sequential( modules=collections.OrderedDict( items=[ [ "encod...
imports = ['base.py'] train_option = {'n_train_iteration': 6000, 'interval_iter': 2000} train_artifact_dir = 'artifacts/train' evaluate_artifact_dir = 'artifacts/evaluate' reference = False model = torch.nn.Sequential(modules=collections.OrderedDict(items=[['encoder', torch.nn.Sequential(modules=collections.OrderedDict...
class Node(object): def __init__(self, children=None, is_root=False): if isinstance(children, Node): children = [children] self.is_root = is_root self.children = list(children) if children else [] @classmethod def precedence(self): return 0 @classmethod ...
class Node(object): def __init__(self, children=None, is_root=False): if isinstance(children, Node): children = [children] self.is_root = is_root self.children = list(children) if children else [] @classmethod def precedence(self): return 0 @classmethod ...
""" Base class for exceptions in this module. This class was created for better extensibility should more features be added and need treatment. """ class Error(Exception): pass """ Exception raised for errors in the input. Attributes: msg -- explanation of the error """ class InputError(Error): def __i...
""" Base class for exceptions in this module. This class was created for better extensibility should more features be added and need treatment. """ class Error(Exception): pass '\nException raised for errors in the input.\n\nAttributes:\n msg -- explanation of the error\n' class Inputerror(Error): def __...
# Copyright (c) 2010-2013 OpenStack, 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
class Clientexception(Exception): def __init__(self, msg, http_scheme='', http_host='', http_port='', http_path='', http_query='', http_status=0, http_reason='', http_device='', http_response_content=''): Exception.__init__(self, msg) self.msg = msg self.http_scheme = http_scheme se...
class Solution: def regionsBySlashes(self, grid: List[str]) -> int: def dfs(i, j, k): if 0 <= i < n > j >= 0 and not matrix[i][j][k]: if grid[i][j] == "*": if k <= 1: matrix[i][j][0] = matrix[i][j][1] = cnt dfs(i...
class Solution: def regions_by_slashes(self, grid: List[str]) -> int: def dfs(i, j, k): if 0 <= i < n > j >= 0 and (not matrix[i][j][k]): if grid[i][j] == '*': if k <= 1: matrix[i][j][0] = matrix[i][j][1] = cnt ...
# The MIT License (MIT) # # Copyright (c) 2016 Scott Shawcroft for Adafruit Industries # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the ...
""" `adafruit_register.spi_bit` ==================================================== Single bit registers * Author(s): Scott Shawcroft * Adaptation by Max Holliday """ class Rwbit: """ Single bit register that is readable and writeable. Values are `bool` :param int register_address: The register ad...
class SubroutineDeclaration: def __init__(self, header, varrefs, body, function=False): ''' @param header: a tuple of (name, arglist) @param body: a tuple of (subroutine statements string, span in source file); The span is a (startpos, endpos) tuple. ...
class Subroutinedeclaration: def __init__(self, header, varrefs, body, function=False): """ @param header: a tuple of (name, arglist) @param body: a tuple of (subroutine statements string, span in source file); The span is a (startpos, endpos) tuple. ...
class AccessDeniedException(Exception): def __init__(self, message): pass # Call the base class constructor # super().__init__(message, None) # Now custom code # self.errors = errors class InvalidEndpointException(Exception): def __init__(self, message): self.m...
class Accessdeniedexception(Exception): def __init__(self, message): pass class Invalidendpointexception(Exception): def __init__(self, message): self.message = message class Bucketmightnotexistexception(Exception): def __init__(self): pass
def includeme(config): config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.add_route('login', '/login') config.add_route('launchpad', '/launchpad') config.add_route('request_rx', '/request_rx') config.add_route('rx_portal', '/rx_portal') config...
def includeme(config): config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('home', '/') config.add_route('login', '/login') config.add_route('launchpad', '/launchpad') config.add_route('request_rx', '/request_rx') config.add_route('rx_portal', '/rx_portal') config...
class DocumentTemplate: def __init__(self): pass @staticmethod def create_db_template(server, db_id, label, **kwargs): db_url = "{}{}".format(server, db_id) comment = kwargs.get("comment") language = kwargs.get("language", "en") allow_origin = kwargs.get("allow_origi...
class Documenttemplate: def __init__(self): pass @staticmethod def create_db_template(server, db_id, label, **kwargs): db_url = '{}{}'.format(server, db_id) comment = kwargs.get('comment') language = kwargs.get('language', 'en') allow_origin = kwargs.get('allow_orig...
def DistanceToPlane(plane, point): """Returns the distance from a 3D point to a plane Parameters: plane (plane): the plane point (point): List of 3 numbers or Point3d Returns: number: The distance if successful, otherwise None Example: import rhinoscriptsyntax as rs ...
def distance_to_plane(plane, point): """Returns the distance from a 3D point to a plane Parameters: plane (plane): the plane point (point): List of 3 numbers or Point3d Returns: number: The distance if successful, otherwise None Example: import rhinoscriptsyntax as rs point...
numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] #using list comprehension to make square of given numbers in list squared_numbers=[ n * n for n in numbers] print(squared_numbers)
numbers = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] squared_numbers = [n * n for n in numbers] print(squared_numbers)
class NothingToProcess(ValueError): pass class FileAlreadyProcessed(ValueError): pass
class Nothingtoprocess(ValueError): pass class Filealreadyprocessed(ValueError): pass
# kpbochenek@gmail.com def most_difference(*args): if not args: return 0 mn = min(args) mx = max(args) return mx - mn if __name__ == '__main__': # These "asserts" using only for self-checking and not necessary for auto-testing def almost_equal(checked, correct, significant_digits): ...
def most_difference(*args): if not args: return 0 mn = min(args) mx = max(args) return mx - mn if __name__ == '__main__': def almost_equal(checked, correct, significant_digits): precision = 0.1 ** significant_digits return correct - precision < checked < correct + precision ...
scope_configuration = dict( drivers = ( # order is important! ('stand', 'leica.stand.Stand'), ('stage', 'leica.stage.Stage'), #('nosepiece', 'leica.nosepiece.MotorizedNosepieceWithSafeMode'), # dm6000 #('nosepiece', 'leica.nosepiece.MotorizedNosepiece'), # dmi8 #('nosepiece',...
scope_configuration = dict(drivers=(('stand', 'leica.stand.Stand'), ('stage', 'leica.stage.Stage'), ('iotool', 'iotool.IOTool'), ('tl.lamp', 'tl_lamp.SutterLED_Lamp'), ('camera.acquisition_sequencer', 'acquisition_sequencer.AcquisitionSequencer'), ('camera.autofocus', 'autofocus.Autofocus'), ('job_runner', 'runner_devi...
a = set(input().split()) n = int(input()) for _ in range(n): b = set(input().split()) if not a.issuperset(b): print(False) break else: print(True)
a = set(input().split()) n = int(input()) for _ in range(n): b = set(input().split()) if not a.issuperset(b): print(False) break else: print(True)
def move(disks, source, auxiliary, target): if disks > 0: # move `N-1` discs from source to auxiliary using the target # as an intermediate pole move(disks - 1, source, target, auxiliary) print("Move disk {} from {} to {}".format(disks, source, target)) # move `N-1` discs f...
def move(disks, source, auxiliary, target): if disks > 0: move(disks - 1, source, target, auxiliary) print('Move disk {} from {} to {}'.format(disks, source, target)) move(disks - 1, auxiliary, source, target) if __name__ == '__main__': n = 3 move(N, 1, 2, 3)
# Runners group runners = ['harry', 'ron', 'harmoine'] our_group = ['mukul'] while runners: athlete = runners.pop() print("Adding user: " + athlete.title()) our_group.append(athlete) print("That's our group:- ") for our_group in our_group: print(our_group.title() + " from harry potter!") Dream_vacatio...
runners = ['harry', 'ron', 'harmoine'] our_group = ['mukul'] while runners: athlete = runners.pop() print('Adding user: ' + athlete.title()) our_group.append(athlete) print("That's our group:- ") for our_group in our_group: print(our_group.title() + ' from harry potter!') dream_vacation = {} polling_act...
n = int(input(" ")) S = 0 a = list(map(int,input(" ").split())) #A massiv for i in range(-n,0): S+=a[i] for i in range(-n,0): if a[i] <= S/n: print(" ",a[i])
n = int(input(' ')) s = 0 a = list(map(int, input(' ').split())) for i in range(-n, 0): s += a[i] for i in range(-n, 0): if a[i] <= S / n: print(' ', a[i])
class FunctionPluginError(RuntimeError): """Error raised when there's a problem with a function plugin itself.""" class FunctionArgError(ValueError): """Error raised when a function plugin has a problem with the function arguments."""
class Functionpluginerror(RuntimeError): """Error raised when there's a problem with a function plugin itself.""" class Functionargerror(ValueError): """Error raised when a function plugin has a problem with the function arguments."""
class User: ''' User class for user input ''' user_list = [] # User Empty list def __init__(self, username, password): self.username = username self.password = password def save_user(self): ''' save_usermethod saves user objects into user_list '''...
class User: """ User class for user input """ user_list = [] def __init__(self, username, password): self.username = username self.password = password def save_user(self): """ save_usermethod saves user objects into user_list """ User.user_list....
#==================== Engine ==================== def run(code): state = EngineState() while True: ip = state.ip if ip >= len(code): break state.ip = ip + 1 (fun,arg) = code[ip] fun(state, arg) class EngineState: def __init__(self): self.ip = 0 self.g...
def run(code): state = engine_state() while True: ip = state.ip if ip >= len(code): break state.ip = ip + 1 (fun, arg) = code[ip] fun(state, arg) class Enginestate: def __init__(self): self.ip = 0 self.gctx = [] self.lctx = [] ...
""" # Definition for a Node. class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right """ class Solution: def __init__(self): self.head = None self.prev = None def treeToDoublyList(self, root: 'Optional[Node]') ->...
""" # Definition for a Node. class Node: def __init__(self, val, left=None, right=None): self.val = val self.left = left self.right = right """ class Solution: def __init__(self): self.head = None self.prev = None def tree_to_doubly_list(self, root: 'Optional[Node]...