content
stringlengths
7
1.05M
class TreeNode: def __init__(self, val, left=None, right=None): self.val = val self.right = right self.left = left class Solution: def searchBST(self, root, val): # if not root: # return None # if root.val == val: # return root ...
#!usr/bin/env python3 color_chart = { '1C1':[13.24, 88.89, 228.98, 0.], '1N1':[14.2, 95.37, 233.82, 0.], '1N2':[12.95, 91.79, 219.5, 0.], '1W1':[14.67, 103.64, 229.41, 0.], '1W2':[14.69, 106.34, 227.28, 0.], '2C0':[15.73, 134.68, 222.32, 0.], '2C1':[14.57, 125.89, 220.69, 0.], '2C3':[13.7, 103.72, 199.4...
# !!!!!!! This file is OBSOLETE. Its content has been absorbed into pilotController.py in the autopilot repository. # !!!!!!! Questions to Torre Wenaus. PandaSiteIDs = { 'AGLT2' : {'nickname':'AGLT2-condor','status':'OK'}, 'ALBERTA-LCG2' : {'nickname':'ALBERTA-LCG2-lcgce01-atlas-lcgpb...
class ScenarioError(Exception): pass class ScenarioTxError(ScenarioError): pass class TokenRegistrationError(ScenarioTxError): pass class ChannelError(ScenarioError): pass class TransferFailed(ScenarioError): pass class NodesUnreachableError(ScenarioError): pass class RESTAPIError(Sc...
def truncatechars(value, arg): """ Truncates a string after a certain number of chars. Argument: Number of chars to truncate after. """ try: length = int(arg) except ValueError: # Invalid literal for int(). return value # Fail silently. if len(value) > length: retu...
def convertToHEXForChar(charList): convertedCharList = [] for message in charList: convertedCharList.append(ord(message)) return convertedCharList def displayChar(line, *args): concatedList = [] for argItem in args: concatedList.extend(argItem) print(len(concatedList)) for message in c...
# ------------------------------------------------------- class: Constants ------------------------------------------------------- # class Constants: # --------------------------------------------------- Public properties -------------------------------------------------- # USER_AGENT_FILE_NAME = 'ua....
expected = [ { "abstract_type": None, "content": "RET can be activated in cis or trans by its co-receptors and ligands in vitro, but the physiological roles of trans signaling are unclear. Rapidly adapting (RA) mechanoreceptors in dorsal root ganglia (DRGs) express Ret and the co-receptor Gfr\u03b12...
# Prim's Algorithm in Python INF = 9999999 # number of vertices in graph V = 5 # create a 2d array of size 5x5 # for adjacency matrix to represent graph G = [ [0, 9, 75, 0, 0], [9, 0, 95, 19, 42], [75, 95, 0, 51, 66], [0, 19, 51, 0, 31], [0, 42, 66, 31, 0], ] # create a array to track...
def func(a, b): return a + b def func2(a): print(a) print("Hello")
# Dimmer Switch class class DimmerSwitch(): def __init__(self, label): self.label = label self.isOn = False self.brightness = 0 def turnOn(self): self.isOn = True # turn the light on at self.brightness def turnOff(self): self.isOn = False # ...
print(list(range(10, 0, -2))) # if start > end and step > 0: # a list generated from start to no more than end with step as constant increment # if start > end and step < 0: # an empty list generated # if start < end and step > 0: # an empty list generated # if start < end and step < 0 # a list generated from start to ...
start = 104200 end = 702648265 for arm1 in range(start, end + 1): exp = len(str(arm1)) num_sum = 0 c = arm1 while c > 0: num = c % 10 num_sum += num ** exp c //= 10 if arm1 != num_sum: continue else: if arm1 == num_sum: ...
def _do_set(env, name, value): if env.contains(name): env.set(name, value) elif env.parent is not None: _do_set(env.parent, name, value) else: raise Exception( "Attempted to set name '%s' but it does not exist." % name ) def set_(env, symbol_name, va...
class PostgresQueryPart: """ Object representing Postgres query part """ def get_query(self) -> str: """ Get query Returns: str """ pass
def email_subject(center_name): return f"[Urgent Reminder] Vaccine slot is now available at {center_name}" def email_body(email_data): return f"Hi, \n" \ f"Vaccine slot is available for below centers \n " \ f"Center name and available data \n {email_data} \n" \ f"Please regis...
# -*- coding: utf-8 -*- # # Copyright Contributors to the Conu project. # SPDX-License-Identifier: MIT # # TODO: move this line to some generic constants, instead of same in # docker and nspawn CONU_ARTIFACT_TAG = 'CONU.' CONU_IMAGES_STORE = "/opt/conu-nspawn-images/" CONU_NSPAWN_BASEPACKAGES = [ "dnf", "ipro...
dict = {} lista = [] soma = 0 while True: dict['nome'] = str(input('Nome: ')).capitalize() dict['sexo'] = str(input('Sexo: ')).strip().upper()[0] while dict['sexo'] not in 'MF': print('ERRO! Por favor, digite apenas M ou F') dict['sexo'] = str(input('Sexo: ')).strip().upper()[0] dict['id...
""" Opdracht 9 - Loonbrief https://dodona.ugent.be/nl/exercises/990750894/ """ # functie voor start amount def get_start_amount(): # return start amount return int(input("Start bedrag: ")) # functie voor salaris def get_salary(): # array van salaris maken salary = [] # count op nul zetten c...
def get_p_distance(list1, list2): count = 0 i = 0 while i < len(list1): if (list1[i] != list2[i]): count += .1 i += 1 return count def get_p_distance_matrix(list1, list2, list3, list4): dna1 = get_p_distance(list1, list1), get_p_distance(list1, list2), get_p_distance(lis...
# # PySNMP MIB module ZHONE-COM-IP-FILTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZHONE-COM-IP-FILTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:47:04 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
"""Exceptions for this library""" class NSBaseError(Exception): """Base Error for all custom exceptions""" pass class RateLimitReached(NSBaseError): """Rate Limit was reached""" class NSServerBaseException(NSBaseError): """Exceptions that the server returns""" pass class APIError(NSServerBaseEx...
def sync_read(socket, size): """ Perform a (temporary) blocking read. The amount read may be smaller than the amount requested if a timeout occurs. """ timeout = socket.gettimeout() socket.settimeout(None) try: return socket.recv(size) finally: socket.settimeout(time...
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
""" Q146 LRU Cache Medium Author: Lingqing Gan Date: 08/06/2019 Question: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return ...
# https://leetcode.com/problems/contains-duplicate/ # We are forming whole set always which isn't optimal though time complexity is O(n). class Solution: def containsDuplicate(self, nums: List[int]) -> bool: return len(nums) != len(set(nums))
entrada = str(input('Em que cidade você nasceu? ')) cidade = entrada.strip().lower() partido = cidade.split() pnome = partido[0] santo = (pnome == 'santo') print(santo)
a='' n=int(input()) while n != 0: a=str(n%2)+a n//=2 print(a)
""" ALGORITHM : Merge Sort WORST CASE => { PERFORMANCE: O(n log(n)) SPACE: O(n) } """ def merge_sort(arr): size = len(arr) if size == 1: return arr elif size == 2: if arr[1] > arr[0]: return [arr[0], arr[1]] mid = len(arr) // 2 lef...
# -*- coding: utf-8 -* # Copyright (c) 2020 PaddlePaddle 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 # # U...
# Time: O(|V| + |E|) # Space: O(|V|) # """ # This is HtmlParser's API interface. # You should not implement it, or speculate about its implementation # """ class HtmlParser(object): def getUrls(self, url): """ :type url: str :rtype List[str] """ pass class Solution(object): ...
class UniErrors(Exception): pass class SetupErrors(UniErrors): pass class SettingErrors(UniErrors): pass class ConfigureSyntaxErrors(UniErrors): pass class NoLocationErrors(UniErrors): pass class ImportedErrors(UniErrors): pass class KernelWaresSettingsErrors(UniErrors): pass c...
"""Values for controlled vocabularies from ENA. Taken from - https://ena-docs.readthedocs.io/en/latest/submit/reads/webin-cli.html """ # Constants for platform definitions. LS454 = "LS454" ILLUMINA = "ILLUMINA" PACBIO_SMRT = "PACBIO_SMRT" IONTORRENT = "ION_TORRENT" CAPILLARY = "CAPILLARY" ONT = "OXFOR...
""" Copyright 2012 Numan Sachwani <numan@7Geese.com> This file is provided to you 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...
""" Settings for re-running the experiments from the paper "Layer-wise relevance propagation for explaining deep neural network decisions in MRI-based Alzheimer’s disease classification". Please note that you need to download the ADNI data from http://adni.loni.usc.edu/ and preprocess it using https://github.com/ANT...
def string_to_list(string,array): x=input(string) i=1 while x[i]!=']': if x[i]!=',': j=i temp='' while x[j]!=',': if x[j]==']': break temp+=x[j] j+=1 i=j array.append(i...
# You are given an array (which will have a length of at least 3, but could be very large) containing integers. The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N. Write a method that takes the array as an argument and returns this "outlier" N. #...
""" A student is taking a cryptography class and has found anagrams to be very useful. Two strings are anagrams of each other if the first string's letters can be rearranged to form the second string. In other words, both strings must contain the same exact letters in the same exact frequency. For example, bacdc an...
''' # ReadQuickly 后端 ``` |-- Server |-- __init__.py |-- server.py (请求服务器) |-- content.py (整合响应数据) |-- spider (爬虫包) |-- weather (天气包) |-- notice (通知包) ``` '''
idadevelho=0 s=0 f=0 for p in range(1,3): print('---{}º pessoa---'.format(p)) nome=str(input('digite o {}º nome: '.format(p))).strip() idade=int(input('digite a idade da {}º pessoa: '.format(p))) peso=float(input('digite o peso da {}º pessoa: '.format(p))) sexo=str(input('sexo[M/F]: ')).upper()...
# # 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 PR...
#Assignment 9.4 #print('Hello World') fname = input('Enter name: ') if len(fname) < 1 : fname = 'mbox-short.txt' handle = open(fname) di = {} #create an empty dictionary for line in handle: line = line.rstrip() wds = line.split() #the second for-loop to print each word in the list for w in wds : ...
class TypeRef: '''Represents temporary type references by an integer; to be resolved to actual types later ''' def __init__(self, type_ref: int): self.type_ref = type_ref def __hash__(self): return hash(self.type_ref) def __eq__(self, other): return isinstance(other,...
#!/usr/bin/env python # encoding: utf-8 def run(whatweb, pluginname): whatweb.recog_from_file(pluginname, "doc/page/login.asp", "Hikvision")
"""In this module we provide a list paths, urls and other usefull settings.""" GITHUB_URL = "https://github.com/MarcSkovMadsen/awesome-panel/" GITHUB_BLOB_MASTER_URL = "https://github.com/MarcSkovMadsen/awesome-panel/blob/master/" GITHUB_RAW_URL = "https://raw.githubusercontent.com/MarcSkovMadsen/awesome-panel/maste...
# # @lc app=leetcode.cn id=461 lang=python3 # # [461] 汉明距离 # # https://leetcode-cn.com/problems/hamming-distance/description/ # # algorithms # Easy (79.21%) # Likes: 459 # Dislikes: 0 # Total Accepted: 137K # Total Submissions: 170K # Testcase Example: '1\n4' # # 两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目。 # # 给出两个整数 x ...
wt1_10_10 = {'192.168.122.110': [5.5754, 5.5952, 9.2422, 8.5338, 9.0058, 8.4025, 8.7557, 8.4405, 8.1397, 8.1318, 8.0657, 7.8501, 8.1701, 8.0757, 7.8899, 7.7329, 7.6153, 7.9967, 7.9363, 7.838, 8.7936, 8.6351, 8.5151, 8.6381, 8.7262, 8.816, 8.8984, 8.7799, 8.8584, 8.9543, 8.8833, 8.794, 8.6935, 8.735, 8.635, 8.5429, 8.6...
""" How to find only the duplicates """ some_list = ['a', 'b', 'c', 'b', 'd', 'm', 'n', 'n'] duplicates = [] # o noua lista unde adaugam duplicatele for value in some_list: if some_list.count(value) > 1: # cand in lista numaram fiecare valoarea si se gaseste mai mult de o data if value not in duplicates...
""" flopz. Low Level Assembler and Firmware Instrumentation Toolkit """ __version__ = "0.2.0" __author__ = "Noelscher Consulting GmbH"
''' Created on 18.03.2020 @author: LK ''' class TMC_EvalShield(object): """ Arguments: connection: Type: connection interface The connection interface used for this module. shield: Type: class The EvalShield class used for every axis on this mod...
RRNN_SEMIRING = """ extern "C" { __global__ void rrnn_semiring_fwd( const float * __restrict__ u, const float * __restrict__ eps, const float * __restrict__ c1_init, const float * __restrict__ c2_init, const int len, ...
"""Provide meta-models for Asset Administration Shell information model.""" __version__ = "2021.11.20a2" __author__ = ( "Nico Braunisch, Marko Ristin, Robert Lehmann, Marcin Sadurski, Manuel Sauer" ) __license__ = "License :: OSI Approved :: MIT License" __status__ = "Alpha"
#!/usr/bin/env python3 def simulate(reg_0, find_non_loop): seen = set() c = 0 last_unique_c = -1 while True: a = c | 65536 c = reg_0 while True: c = (((c + (a & 255)) & 16777215) * 65899) & 16777215 if a < 256: if find_non_loop: ...
# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2021 Filipe Laíns <lains@riseup.net> def test_dispatch(basic_device): basic_device.protocol_dispatch([0x03, 0x02, 0x01]) # unrelated basic_device.protocol_dispatch([0x20]) # invalid length short basic_device.protocol_dispatch([0x21]) # invalid le...
# Directions UP = 'UP' DOWN = 'DOWN' LEFT = 'LEFT' RIGHT = 'RIGHT' # Colors RED = (255, 0, 0) BLACK = (0, 0, 0) GREEN = (0, 255, 0) WHITE = (255, 255, 255)
#!/usr/bin/env python3 flags = ['QCTF{2a5576bc51a5c3feb82c96fe80d3a520}', 'QCTF{eb2ddbf0e318812ede843e8ecec6144f}', 'QCTF{5cdf65c6069a6b815352c3f1b4d09a56}', 'QCTF{69d7b7deb23746b8bd18b22f3eb92b50}', 'QCTF{44e37938c0bc05393b5b33a70c5a70db}', 'QCTF{3b37a953391e38ce0b8e168e9eaa6ec5}', 'QCTF{ee2848cb73236007d36cb5ae75c4...
#var #num, media, i: inteiro media=0 for i in range(1,11,1): num=int(input("Digite um número: ")) media = media+num media=media/i print (media)
#!/usr/bin/env python ''' Este programa se repetirá 3 veces o hasta que se ingrese la palabra "despedida" y desplegará sólo el número de intentos fallidos hasta que cualquiera de los eventos ocurentradara. Al ingresar la palabra "termina" el programa se detendrá.''' entrada = "" suma = 0 while su...
def transaccion(retiro, saldo): if retiro % 5 != 0: return(saldo) elif (saldo - retiro) < 0: return(saldo) elif saldo == retiro: return(saldo) else: return(saldo - retiro - 0.5) def main(): entrada = open("input.txt","r") salida = open("output.txt","w") T = ...
class ToFile: """ Classe que recebe uma instância de dados e os salva em um arquivo de saída. """ def __init__(self, path, data): maxs = [len(x) + 4 for x in data.legend] with open(path, 'w') as file: file.write('id' + (' ' * 6)) for index, element in enumerate(data.legend): file.write(...
_base_config_ = ["base.py"] generator = dict( input_cse=True, use_cse=True ) discriminator=dict( pred_only_cse=False, pred_only_semantic=True ) loss = dict( gan_criterion=dict(type="segmentation", seg_weight=.1) )
""" Function def function_name(arg1, arg2, ...) : <op 1> <op 2> ... Function with undefined amount of input def fn_name(*args) --> args' elements make tuple. kwargs = Keyword Parameter >>> def print_kwargs(**kwargs): ... print(kwargs) ... >>> print_kwargs(a=1) {...
# Python - 3.4.3 Test.it('Basic Tests') Test.assert_equals(invert([1, 2, 3, 4, 5]), [-1, -2, -3, -4, -5]) Test.assert_equals(invert([1, -2, 3, -4, 5]), [-1, 2, -3, 4, -5]) Test.assert_equals(invert([]), [])
# # @lc app=leetcode.cn id=47 lang=python3 # # [47] 全排列 II # # https://leetcode-cn.com/problems/permutations-ii/description/ # # algorithms # Medium (59.58%) # Likes: 371 # Dislikes: 0 # Total Accepted: 78.7K # Total Submissions: 132.1K # Testcase Example: '[1,1,2]' # # 给定一个可包含重复数字的序列,返回所有不重复的全排列。 # # 示例: # # ...
__title__ = 'logxs' __description__ = 'Replacing with build-in `print` with nice formatting.' __url__ = 'https://github.com/minlaxz/logxs' __version__ = '0.3.2' __author__ = 'Min Latt' __author_email__ = 'minminlaxz@gmail.com' __license__ = 'MIT'
num = input() lucky = 0 for i in num: if i == '4' or i == '7': lucky += 1 counter = 0 for c in str(lucky): if c == '4' or c == '7': counter += 1 if counter == len(str(lucky)): print("YES") else: print("NO")
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ I=lambda:map(int,input().split()) f=abs n,_,a,b,k=I() while k: p,q,u,v=I() P=[a,b] if a<=q<=b:P+=[q] if a<=v<=b:P+=[v] print([min(f(q-x)+f(v-x)for x in P)+f(p-u),f(q-v)][p==u]) k-=1
s=str(input()) a=[] for i in range(len(s)): si=s[i] a.append(si) b=[] n=str(input()) for j in range(len(n)): sj=n[j] b.append(sj) p={} for pi in range(len(s)): key=s[pi] p[key]=0 j1=0 for i in range(0,len(a)): key=a[i] while j1<len(b): bj=b[0] if key in p: p[k...
"""This module implements backtracking algorithm to solve sudoku.""" class Board: """ Class for sudoku board representation. """ NUMBERS = [1, 2, 3, 4, 5, 6, 7, 8, 9] def __init__(self, board): """ Create a new board. """ self.board = board def __str__(self) ...
N, *A = map(int, open(0).read().split()) A.sort() for i in range(N): if i == A[i] - 1: continue print('No') break else: print('Yes')
class status(Exception): def __init__(self, code=200, response=None): super().__init__("season.core.CLASS.RESPONSE.STATUS") self.code = code self.response = response def get_response(self): return self.response, self.code
#!/usr/bin/env python3 def calculate(): ans = sum(1 for i in range(1, 10000000) if get_terminal(i) == 89) return str(ans) TERMINALS = (1, 89) def get_terminal(n): while n not in TERMINALS: n = square_digit_sum(n) return n def square_digit_sum(n): result = 0 ...
def gen_doc_html(version, api_list): doc_html = f''' <!DOCTYPE html> <html> <head><meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type="text/css"> body{{margin:40px auto; max-width:650px; line-height:1.6; font...
countries = {'Russia' : 'Europe', 'Germany' : 'Europe', 'Australia' : 'Australia'} sqrs = {} sqrs[1] = 1 sqrs[2] = 4 sqrs[10] = 100 print(sqrs) myDict = dict([['key1', 'value1'], ('key2', 'value2')]) print(myDict) phones = {'police' : 102, 'ambulance' : 103, 'firefighters' : 101} print(phones['police']) phones = {'...
def f(x): '''Does nothing. :type x: a.C ''' pass
# this should accept a command as a string, and raturn a string detailing the issue # if <command> is not a valid vanilla minecraft command. None otherwise. def check(command): return None
print("One") print("Two") print("Three")
""" from https://github.com/keithito/tacotron """ _pad = '_' #_punctuation = '!\'(),.:;? ' _punctuation = '!",.:;? ' _special = '-' #_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' _letters = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя" symbols = [_pad] + list(_special...
# encoding: utf-8 # module Autodesk.Revit.UI.Plumbing calls itself Plumbing # from RevitAPIUI,Version=17.0.0.0,Culture=neutral,PublicKeyToken=null # by generator 1.145 # no doc # no imports # no functions # classes class IPipeFittingAndAccessoryPressureDropUIServer(IExternalServer): """ Interface for exte...
''' Created on Jul 19, 2012 @author: Chris ''' class Command(object): def validate(self, game): pass def execute(self, game): pass
# menu_text.py # # simple python menu # https://stackoverflow.com/questions/19964603/creating-a-menu-in-python # city_menu = { '1': 'Chicago', '2': 'New York', '3': 'Washington', 'x': 'Exit'} month_menu = {'0': 'All', '1': 'January', '2': 'February...
""" Log multiple instances to same file. """ def log(msg): f = open('error.log', 'a') f.write(msg+'\n') f.close() def clear(): f = open('error.log', 'w') f.write('') f.close()
hex_strings = [ "FF 81 BD A5 A5 BD 81 FF", "AA 55 AA 55 AA 55 AA 55", "3E 7F FC F8 F8 FC 7F 3E", "93 93 93 F3 F3 93 93 93", ] def hex_data_to_image(hex_data): for hex_pair in hex_data: for divisor in reversed(range(len(hex_data))): print("X" if (int(hex_pair, 16) >> divisor & 1) == 1 else " ", end=...
L = ['michael', 'sarah', 'tracy', 'bob', 'jack'] # 取前N个元素 r = [] n = 3 for i in range(n): r.append(L[i]) print(r) # python提供slice操作符简化. m = 0 print(L[m:n], L[:n], L[-n:-1]) L = list(range(100)) print(L[:10], '\r', L[-10:], '\r', L[10:20], '\r', L[:10:2], '\r', L[::5]) print((0, 1, 2, 3, 4, 5)[:3]) print('ABCDEFG'[:3...
# -*- coding: utf-8 -*- # Copy this file and renamed it settings.py and change the values for your own project # The csv file containing the information about the member. # There is three columns: The name, the email and the member type: 0 regular, 1 life time CSV_FILE = "path to csv file" # The svg file for regular...
i = 0 while (i<119): print(i) i+=10
# The shape of the numbers for the dice dice = { 1: [[None, None, None], [None, "", None], [None, None, None]], 2: [["", None, None], [None, None, None], [None, None, ""]], 3: [["", None, None], [None, "", None], [None, None, ""]], 4: [["", None, ""], [None, None, None], ["", None, ""]], ...
# def fib2(n): # 返回到 n 的斐波那契数列 # result = [] # a, b = 0, 1 # while b < n: # result.append(b) # a, b = b, a+b # return result # # a = fib2(500) # print(a) def recur_fibo(n): """递归函数 输出斐波那契数列""" if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2))...
# __init__.py # Copyright 2017 Roger Marsh # Licence: See LICENCE (BSD licence) """Miscellaneous modules for applications available at solentware.co.uk. These do not belong in the solentware_base or solentware_grid packages, siblings of solentware_misc. """
__author__ = "Music" # MNIST For ML Beginners # https://www.tensorflow.org/versions/r0.9/tutorials/mnist/beginners/index.html
# -*- coding: utf-8 -*- """ 1556. Thousand Separator Given an integer n, add a dot (".") as the thousands separator and return it in string format. Constraints: 0 <= n < 2^31 """ class Solution: def thousandSeparator(self, n: int) -> str: res = "" str_n = str(n) count = 0 ind = ...
# -*- coding: utf-8 -*- CHECKLIST_MAPPING = { 'checklist_retrieve': { 'resource': '/checklists/{id}', 'docs': ( 'https://developers.trello.com/v1.0/reference' '#checklistsid' ), 'methods': ['GET'], }, 'checklist_field_retrieve': { 'resource': ...
days = int(input()) sladkar = int(input()) cake = int(input()) gofreta = int(input()) pancake = int(input()) cake_price = cake*45 gofreta_price = gofreta*5.8 pancake_price = pancake*3.2 day_price = (cake_price + gofreta_price + pancake_price)*sladkar total_price = days*day_price campaign = total_price - (total_price/8)...
n = int(input()) lst = list(map(int, input().split())) def sort1(arr): l = len(arr) for i in range(1, n): cur = arr[i] pos = i check = False while pos > 0: if arr[pos - 1] > cur: check = True arr[pos] = arr[pos - 1] e...
radiobutton_style = ''' QRadioButton:disabled { background: transparent; } QRadioButton::indicator { background: palette(dark); width: 8px; height: 8px; border: 3px solid palette(dark); border-radius: 7px; } QRadioButton::indicator:checked { background: palette(highlight); } QRadioButton:...
# # PySNMP MIB module ERI-DNX-STS1-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ERI-DNX-STS1-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:51:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar ...
expected_output = { "location": { "R0 R1": { "auto_abort_timer": "inactive", "pkg_state": { 1: { "filename_version": "17.08.01.0.149429", "state": "U", "type": "IMG", } }, ...
def selection_sort(my_list): for i in range(len(my_list)): min_index=i for j in range(i+1 , len(my_list)): if my_list[min_index]>my_list[j]: min_index= j my_list[i],my_list[min_index]= my_list[min_index] ,my_list[i] print(my_list) cus_list=[8,4,23,42,16,...
class Person: number_of_people = 0 def __init__(self, name): print("__init__ initiated") self.name = name print("calling add_person()") Person.add_person() @classmethod def num_of_people(cls): print("initiating num_of_person()") return cls.number_of_peo...
SEPARATOR: list = [':', ',', '*', ';', '#', '|', '+', '%', '>', '?', '&', '=', '!'] def word_splitter(string: str) -> list: for i in string: if i in SEPARATOR: string = string.replace(i, ' ') return string.split()