content
stringlengths
7
1.05M
def simpleArraySum(ar): return sum(ar) ar_count = int(input()) ar = list(map(int, input().rstrip().split())) result = simpleArraySum(ar) print(result)
''' Utilizar objetos como lista de funções oo varias classes, diferentes arquivos Instanciar objetos, transformar num onjeto real . para orientar heranças variavel.metodo(parametro) self = this como no java override Exercicio: Criar softawe de gerenciamento bancario Este sera capaz de criar clientes e contas cada ...
def read_input(file_name): with open(file_name, mode="r") as input_f: file_content = input_f.read() list_of_initial_state = file_content.strip().split(',') list_of_initial_state = list(map(int, list_of_initial_state)) return list_of_initial_state def simulate_lanternfish(list_of_initi...
# cd drone/starlark/samples # drone script --source pipeline.py --stdout load('docker.py', 'docker') def build(version): return { 'name': 'build', 'image': 'golang:%s' % version, 'commands': [ 'go build', 'go test', ] } def main(ctx): if ctx['build']['message'].find('[skip build]'):...
#!/usr/bin/env python # WARNING: This is till work in progress # # Load into gdb with 'source ../tools/gdb-prettyprint.py' # Make sure to also apply 'set print pretty on' to get nice structure printouts class String: def __init__(self, val): self.val = val def to_string (self): length = int(s...
class State: def __init__(self, name=None, transitions=None): self.name = name self.transitions = {k: v for k, v in transitions} class StateMachine: def __init__(self, states=None, initial_state=None): self.state_mapping = {state.name: state for state in states} self.initial_...
''' Circular Primes The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes are there below one million? ''' def je_prast...
class BaseException(Exception): ... class ATomlConfigError(BaseException): pass
def main(): """ Finds how many outer bags you can use Made for AoC 2020 Day 7: https://adventofcode.com/2020/day/7 """ part_1_test_input = '''light red bags contain 1 bright white bag, 2 muted yellow bags. dark orange bags contain 3 bright white bags, 4 muted yellow bags. bright white bags contain 1 shiny gold b...
n1 = str(input('digite seu nome completo: ')).strip() n2 = n1.split() print('Seu primeiro nome é {}'.format(n2[0])) print('seu ultimo nome é {}'.format(n2[len(n2)-1]))
{ 'includes': [ 'config.gypi', ], 'targets': [ { 'target_name': 'socksd', 'type': 'executable', 'sources': [ 'src/main.c', 'src/Client.c', 'src/Logger.c' ], 'libraries': [ ...
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrder(self, root: TreeNode) -> [[int]]: queue = [root] res = [] if not root: return [] while q...
# THIS FILE IS GENERATED FROM PYWAVELETS SETUP.PY short_version = '1.1.0' version = '1.1.0' full_version = '1.1.0.dev0+20ab3c1' git_revision = '20ab3c1ded9b457c2cb54cb7bbac65479d5c4a00' release = False if not release: version = full_version
# coding: utf-8 ''' Class: VerificaMetadados description: realizar a verificação de artigos produzidos observando existência de metadados de autor e referências bibliográficas author: Adriano dos Santos Vieira <adriano.vieira@dataprev.gov.br> character encoding: UTF-8 @params: (opcional) file_name = nome de arquivo m...
''' estrutura de laço As listas são essenciais para intender a estrutura de laço com esta estrutura e que vamos percorrer estas listas, cada uma de uma vez while for ''' lista_nomes = ['Carlos', 'Marcelo', 'João', 'Julia'] #cont = range(0, 20, 2) ''' range(comecar, ate, step) ''' print('Comecei a processar!...
class Pessoa(): # atributo de classe olhos = 2 def __init__(self, *filhos, nome=None, idade=35): self.nome = nome self.idade = idade self.filhos = list(filhos) def cumprimentar(self): return f'Olá, {id(self)}' if __name__ == "__main__": joao = Pessoa(nome='João V...
def change(s, prog, version): temp=s.split("\n") temp=temp[0:2]+temp[3:-1] temp[0]='Program: '+prog temp[1]="Author: g964" if not valid_number(temp[2].split(": ")[1]): return 'ERROR: VERSION or PHONE' temp[2]="Phone: +1-503-555-0090" temp[3]="Date: 2019-01-01" if not valid_version(temp[4...
'''answer=input() list1=[] i3=0 for i in range(len(answer.split('\n'))): list1.append(answer.split(' ')[i]) for i2 in range(5): number,base=list1[i3],int(list1[i3+1]) i3=i3+2 print(sum([int((number+"0"*(base-len(number)%base))[i*base:(i+1)*base]) for i in range(len(number+"0"*(base-len(number)%base))/...
# -*- coding:utf-8; -*- class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseKGroup(self, head, k): preHead = ListNode(-1) preHead.next = head start, end, count = preHead, start.next, 0 while end: count += ...
def central_suppression_method(valuein: int, rc: str = "5", upper: int = 5000000000) -> str: """ Suppresses and rounds values using the central suppression method. If value is 0 then it will remain as 0. If value is 1-7 it will be suppressed and appear as 5. All other values will be rounded to the ...
n = int(input("Digite a última potencia:")) i = 0 while i <= n: print(2**i) i = i + 1
cc = 0 s = 0 for c in range(0, 501, 3): if c % 2 != 0: s = c + s cc = cc + 1 print('O total de soma de todos os {} números ímpares multiplos de 3 entre 1 e 500 é {}'.format(cc, s))
class DocManagerBase: @staticmethod def apply_update(doc, update_spec): """Apply an update operation to a document.""" if "$set" not in update_spec and "$unset" not in update_spec: # update spec contains the new document in its entirety return update_spec # Help...
class electronics(): tools = [] age = 0 years_of_experience = 0 languages = [] department = "" alex = electronics() alex.tools = ["spice", "eagle"] alex.age = 27 alex.years_of_experience = 3 alex.languages.append("english") alex.department = "electronics" print(alex.tools, alex.age, alex.years_of...
toepic = [60000, 150000, 47619] tounique = [18000, 35000, 19608] tolegendry = [3000, 10000, 4975] # red, black, addtional upgrade_table = [toepic, tounique, tolegendry] # upgrade_table[Source Rank.value][Cube.value] returns threshold. range(0, 100000)
# 工序操作模拟类 class Operation: def __init__(self, id_operation, id_machine, duration): self.__id_operation = id_operation self.__duration = duration self.__id_machine = id_machine self.__time = None self.__is_pending = False self.__place_of_arrival = None # toString 方法 def __str__(self): output = "操作" + s...
class ListGol(object): """ Game of Life implemented via lists :param board: the initial state of the board :type board: :py:class:`gksol.boards.PaddedBoard` or List[List[int]] .. describe:: gol[n] Return the ``n``'th row of the board as a list-like view. """ def __init__(self, boa...
class Meter(): def __init__( self, ): self.reset() def reset( self, ): self.max = None self.min = None self.avg = None self.sum = 0 self.cnt = 0 def update( self, val, ): self.sum += val ...
# -*- coding: utf-8 -*- # 冒泡排序 def bubble_sort(arrlist): if len(arrlist) <= 1: return arrlist for i in range(1, len(arrlist)-1): flag = False #设置置换标识 for j in range(0, len(arrlist) - i - 1): if arrlist[j] > arrlist[j+1]: arrlist[j], arrlist[j+1] = arrlist[j...
# calories calculator print("Today's date?") date = input() print("Breakfast calories?") breakfast = int(input()) print("Lunch calories?") lunch = int(input()) print("Dinner calories?") dinner = int(input()) print("Snack calories?") snack = int(input()) print("Calorie content for " + date + ": "+ str(breakfast + lunch ...
# -*- coding: utf-8 -*- file = open("deneme.txt","r",encoding="utf-8") for i in file: print(i,end="") a = file.read() print(a) print(file.readline()) print(file.readlines()) file.close()
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution(object): def sortList(self, head): """ :type head: ListNode :rtype: ListNode """ def merge(l1, l2): ...
# parsetab.py # This file is automatically generated. Do not edit. # pylint: disable=W,C,R _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'ALL AND ASC BOOLEAN BOUND BY BYTE COLON COMA CONSTANT CONTAINS DATATYPE DATETIME DECIMAL DESC DISTINCT DIV DOUBLE EQUALS FILTER FLOAT GREATER GREATEREQ ID INT INTEGER I...
# region order afr = 'Africa and Middle East' lam = 'Central and South America' chn = 'East Asia' oecd = 'North America, Europe, Russia, Central Asia, and Pacific OECD' asia = 'South and South East Asia, Other Pacific' # new region values from Zig r10sas = 'Southern Asia' r10eur = 'Europe' r10afr = 'Africa' r10sea = '...
def is_leap_year(year): leap = False if(year % 4 == 0): leap = True if(year % 100 == 0): leap = False if(year % 400 == 0): leap = True return leap
# # PySNMP MIB module HUAWEI-ATM-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-ATM-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:42:57 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2...
""" [2015-08-10] Challenge #227 [Easy] Square Spirals https://www.reddit.com/r/dailyprogrammer/comments/3ggli3/20150810_challenge_227_easy_square_spirals/ # [](#EasyIcon) __(Easy)__: Square Spirals Take a square grid, and put a cross on the center point, like this: + + + + + + + + + + ...
# -*- coding: utf-8 -*- class IntegrationInterface(object): properties = [] name = "" title = "" description = "" url = "" allow_multiple = False can_notify_people = False can_notify_group = False can_sync_people = False def __init__(self, integration): self._propert...
# Faça um programa que mostre a tabuada de vários números, um de cada vez, para cada valor digitado pelo usuário. O # programa será interrompido quando o número solicitado for negativo. separador = ('—' * 60) while True: print(separador) n = int(input('Quer ver a tabuada de qual valor? [número negativo para ...
n = int(input()) ansl = {} for _ in range(n): s = input() if s in ansl: ansl[s] += 1 else: ansl[s] = 1 ans = "" max_vote = 0 for k in ansl: if max_vote < ansl[k]: max_vote = ansl[k] ans = k print(ans)
def convert_sample_to_shot_dialKG(sample,with_knowledge): prefix = "Dialogue:\n" assert len(sample["dialogue"]) == len(sample["KG"]) for turn, meta in zip(sample["dialogue"],sample["KG"]): prefix += f"User: {turn[0]}" +"\n" if with_knowledge and len(meta)>0: prefix += f"KG: {meta...
MAXZOOMLEVEL = 32 RESAMPLING_METHODS = ( 'average', 'near', 'bilinear', 'cubic', 'cubicspline', 'lanczos', 'antialias' ) PROFILES = ('mercator', 'geodetic', 'raster')
# -*- coding: utf-8 -*- r"""Testing code for the (Python) optimal_learning library. Testing is done via the Testify package: https://github.com/Yelp/Testify This package includes: * Test cases/test setup files * Tests for classes and utils in :mod:`moe.optimal_learning.python` * Tests for classes and functions in :m...
DUMP_10K_FILE = "/home/agustin/Desktop/Recuperacion/colecciones/dump10k/dump10k.txt" INDEX_FILES_PATH = "output/" BIN_INVERTED_INDEX_FILENAME = "inverted_index.bin" BIN_VOCABULARY_FILENAME = "vocabulary.bin" BIN_SKIPS_FILENAME = "skips.bin" METADATA_FILE = "metadata.json" K_SKIPS = 3
class DISPPARAMS(object): """ Use System.Runtime.InteropServices.ComTypes.DISPPARAMS instead. """ cArgs = None cNamedArgs = None rgdispidNamedArgs = None rgvarg = None
course = 'Python "Programming"' print(course) course = "Python \"Programming\"" # use this to be maintain consistency course = "Python \\Programming\"" # Python \Programming" print(course)
n = int(input()) prev_dst = prev_t = 0 for _ in range(n): t, x, y = map(int, input().split()) dst = x + y ddst = abs(dst - prev_dst) dt = t - prev_t if t % 2 != dst % 2 or ddst > dt: print('No') exit() prev_t, prev_dst = t, dst print('Yes')
class Customer: def __init__(self): self.id = "", self.name = "", self.phone = "", self.email = "", self.username = "", self.address_line_1 = "", self.address_line_2 = "", self.city = "", self.country = ""
counter = 0; with open("./Resources/01. Odd Lines/Input.txt", 'r') as lines: read_line = None while read_line != "": read_line = lines.readline() counter += 1 if counter % 2 == 0: with open("./Resources/01. Odd Lines/Output.txt", 'a') as odd_lines: odd_lines.w...
def func(i): if i % 2 == 0: i = i+1 return i else: x = func(i-1) print('Value of X is ',x) return func(x) func(399)
# key is age, chance is contents def getdeathchance(agent): deathchance = 0.0 if agent.taxon == "savannah": if agent.sex == 'm': deathchance = SavannahLifeTable.male_death_chance[agent.age] else: deathchance = SavannahLifeTable.female_death_chance[agent.age] if age...
"""Azure Provisioning Device Internal This package provides internal classes for use within the Azure Provisioning Device SDK. """
#o programa escreve o fatorial de um número #na linha 3 a variável "numero" pede ao usuário para inserir um valor de tipo primitivo int numero = int(input('Digite um numero: ')) #a variável "cont" recebe o valor da variável "numero" cont = numero #"fatorial" recebe o valor inteiro 1 fatorial = 1 #na linha 8 é mostrado ...
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # Unless required by applicable law...
grocery = ["Harpic", "Vim bar", "deo", "Bhindi", "Lollypop",56] #print(grocery[5]) #numbers = [2,7,5,11,3] #print(numbers[2]) #print(numbers.sort()) sorting done #print(numbers[1:4]) #slicing returning list but will not change original list. #print(numbers) #print(numbers[::3]) #print(numbers[::-1]) #don't take...
def get_pic_upload_to(instance, filename): return "static/profile/{}/pic/{}".format(instance.user, filename) def get_aadhar_upload_to(instance, filename): instance.filename = filename return "static/profile/{}/aadhar/{}".format(instance.user, filename) def get_passbook_upload_to(instance, filename): i...
# -*- coding: UTF-8 -*- class DSException(Exception): pass class DSRequestException(DSException): pass class DSCommandFailedException(DSException): pass
def pluralize(s): last_char = s[-1] if last_char == 'y': pluralized = s[:-1] + 'ies' elif last_char == 's': pluralized = s else: pluralized = s + 's' return pluralized
#Write a function that concatenates two lists. [a,b,c], [1,2,3] → [a,b,c,1,2,3] def concatenates(list_1,list_2): return list_2 + list_1 list_3 = ['a','b','c'] list_4 = [1,2,3] print(concatenates(list_3,list_4))
# # PySNMP MIB module SWAPCOM-SCC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SWAPCOM-SCC # Produced by pysmi-0.3.4 at Wed May 1 15:12:56 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, 0...
""" icons for the developer """ class Icons: python = "🐍" document="📃" dot = "•" right_arrow = "→" check_mark = "✔️" x = "✘" lock = "🔒" please_cloud = "🙏" hexagon = "⬢" rocket = "🚀" sattelite = "🛰" wrench = "🔧" manjaro = "" github = "" horizont...
#!/usr/bin/env python #------------------------------------------------------------------------------- # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def hasCycle(self, head): """ ...
DISCRETE = 0 CONTINUOUS = 1 INITIAL = 0 INTERMEDIATE = 1 FINAL = 2
# python3 def read_input(): return (input().rstrip(), input().rstrip()) def print_occurrences(output): print(' '.join(map(str, output))) def PolyHash(s, prime, multiplier): hash = 0 for c in reversed(s): hash = (hash * multiplier + ord(c)) % prime return hash def Pr...
#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'LiteSpeed (LiteSpeed Technologies)' def is_waf(self): schema1 = [ self.matchHeader(('Server', 'LiteSpeed')), self.matchStatus(403) ] schema2 = [ self.matchCon...
# -*- coding: utf-8 -*- """ Created on Fri Jan 28 16:26:55 2022 @author: leoda """ precedence = { '+': 1, '-': 1, '*': 2, '/': 2, '^': 3, None: 0 } symbols = ['+', '-', '*', '/', '^'] all_allowed = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.', ')', '('] all_allowed.extend(symbols) #...
# -*- coding: utf-8 -*- ##################################################################################################################### # # # Домашнее задание к уроку 1 ...
#!/usr/bin/env python3 """ global user-defined variables """ data_folder: str = 'data' raw_data_folder: str = f'{data_folder}/raw_data' clean_data_folder: str = f'{data_folder}/clean_data' models_folder = f'{data_folder}/models' text_vectorization_folder = f'{models_folder}/vectorization' output_folder: str = 'output'...
'''(Binary Search Special Trick Unknown length [M]): Given a sorted array whose length is not known, perform binary search for a target T. Do the search in O(log(n)) time.''' def binarySearchOverRange(arr, T, low, high): while low <= high: mid = low + (high - low) // 2 if arr[mid] == T: ...
def lengthOfLongestSubstring(self, s: str) -> int: valueMap = dict() pointer = 0 maxLen = 0 for i in range(len(s)): char = s[i] if char in valueMap and pointer <= valueMap[char]: pointer = valueMap[char] + 1 valueMap[char] = i ...
""" Verificação de CPF. Desenvolva um programa que solicite a digitação de um número de CPF no formato xxx.xxx.xxx-xx e indique se é um número válido ou inválido através da validação dos dígitos verificadores edos caracteres de formatação. """ def ValidaCpf(cpf): valido = bool(True) if len(cpf) != 14: ...
# Singly-linked lists are already defined with this interface: class ListNode(object): def __init__(self, x): self.value = x self.next = None def condense_linked_list(node): # Reference the current node's value current = node # List to store the values condensed_list = [] # Loop...
class Trie: ''' 字典树,一次构建,多次查询: 优化过程: 使用list 代替 dict, 理论上来说更加节约内存! ''' def __init__(self): """ Initialize your data structure here. """ self.sub_tree = [None] * 26 # 用list的话, indx : ord(s) - ord('a'), 实际运行来看使用list 并没有优化到内存,可能和题目的测试用例有关,用例少的话,确实使用 dict 还划算一些 self.i...
print("Anand K S") print("AM.EN.U4CSE19106") print("S1 CSE B") print("Marvel rockz")
ct = "eae4a5b1aad7964ec9f1f0bff0229cf1a11b22b11bfefecc9922aaf4bff0dd3c88" ct = bytes.fromhex(ct) flag = "" initialize = 0 for i in range(len(ct)): for val in range(256): if (initialize ^ (val<<2)^val)&0xff == ct[i]: flag += chr(val) initialize ^= (val<<2)^val initializ...
#!/usr/bin/env python # coding: utf-8 # In[ ]: # Yelp Key ID = "Enter Your Yelp ID Here" ykey = "Enter your Yelp API Key Here"
"""#CLASSES, MÉTODOS E SELF""" """ 1 -Classes são abstrações e descrevem como os dados serão representados e manipulados. Em Python, todos os tipos nativos também são classes. Por exemplo, o tipo int é uma classe do Python, que permite representar números inteiros e realizar operações como soma, subtração, multiplicaç...
class Solution: def subtractProductAndSum(self, n: int) -> int: n = str(n) s = 0 p = 1 for c in n: c = int(c) s += c p *= c return p - s
#!/usr/bin/env python3 # Dictionaries map a value to a key, hence a value can be # called using the key. # 1. They ar3333i3ie mutable, ie. they can be changed. # 3. They are surrounded by curly {} brackets. # 3. They are indexed using square [] brackets. # 4. Key and Value pairs are separated by columns ":" # 5. Each...
class RequestError(Exception): def __init__(self, message: str, code: int): super(RequestError, self).__init__(message) self.code = code
# this is the default configuration file for cage interfaces # # request_timeout is conceptually the most far reaching parameter # here, it is one of the guarantees for the entire cage - that it # responds within that time, even though the response is a failure # # thread_count limits the number of threads in the cage'...
""" Build targets for default implementations of tf/core/platform libraries. """ # This is a temporary hack to mimic the presence of a BUILD file under # tensorflow/core/platform/default. This is part of a large refactoring # of BUILD rules under tensorflow/core/platform. We will remove this file # and add real BUILD f...
def cyclical(length=100, relative_min=0.1): '''Also known as triangular, https://arxiv.org/pdf/1506.01186.pdf''' half = length / 2 def _cyclical(step, multiplier): return ( step, multiplier * ( relative_min + (1 - relative_min) * abs( ((...
L = int(input()) C = int(input()) t2 = (((L - 1) + (C - 1)) * 2) t1 = (L * C) + ((L - 1) * (C - 1)) print(f"{t1}\n{t2}")
class usuario (): "Clase que representa una persona." def __init__(self, dni, nombre, apellido): "Constructor de Persona" self.dni = dni self.nombre = nombre self.apellido = apellido def carritoCompras(self,carrito): self.carrito=carrito return def __...
class AlreadyInDatabase(Exception): pass class MissingUnit(Exception): pass
name0_1_0_0_0_0_0 = None name0_1_0_0_0_0_1 = None name0_1_0_0_0_0_2 = None name0_1_0_0_0_0_3 = None name0_1_0_0_0_0_4 = None
# # MIT License # # brutemind framework for python # Copyright (C) 2018 Michael Lin, Valeriy Garnaga # # 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 w...
class BinHeap(object): def __init__(self): self.size = 0 self.heapList = [0] def __str__(self): return '[ ' + ' '.join(str(i) for i in self.heapList[1:]) + ' ]' def _percolateUp(self, i): while i // 2 > 0: if self.heapList[i] < self.heapList[i // 2]: ...
# Định nghĩa một hàm: def sayHello(name): # Kiểm tra nếu name là rỗng (empty) hoặc null. if not name: print("Hello every body!") # Nếu name không rỗng và không null. else: print("Hello " + name) # Gọi hàm, truyền tham số vào hàm. sayHello("") sayHello("Python") sayHello("Java")
class Solution: def arrangeCoins(self, n: int) -> int: res =1 while res*(res+1)<=2*n: res +=1 res-=1 return res
# # PySNMP MIB module Unisphere-Data-MPLS-CONF (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-MPLS-CONF # Produced by pysmi-0.3.4 at Mon Apr 29 21:24:50 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7....
DOUBLE_QUOTE = '[”|"]' SINGLE_QUOTE = "[’|']" SETS = r'(?:(\d+)\s*x\s*)?' REPEATS = r'(\d+)\s*x\s*' DISTANCE = r'(\d+)\s*' PACE_OR_INTENSITY = r'\((.*?)\)\s*' RECOVERY_BETWEEN_REPETITIONS_AND_OR_SETS = \ r'(?:\[(.*?)(?:\s*&\s*(.*?))?\]\s*)?' RECOVERY_BETWEEN_SETS = r'(?:\[(.*?)\])?' GROUPED_SETS_REGEX = r'(\d+)\...
# 1 задача for i in range(1,6): print(i, i*0) #2 задача a = int(input()) b = int(input()) c = int(input()) d = int(input()) e = int(input()) f = int(input()) g = int(input()) h = int(input()) i = int(input()) j = int(input()) summm = 0 if a==5: summm += 1 if b==5: summm += 1 if c==5: summm += 1 if d==5:...
''' Devita é o príncipe dos Calsadins. Juntamente com Pana, eles vão atrás de Tataroko, o nome de nascimento de Kogu, para tentar dominar o mundo. Ele possui um rastreador que mede o nível de energia de qualquer ser vivo. Todos os seres com o nível menor ou igual a 8000, ele considera como se fosse um inseto. Quando pa...
''' Descripttion: version: Author: HuSharp Date: 2021-02-07 09:09:55 LastEditors: HuSharp LastEditTime: 2021-02-08 10:17:11 @Email: 8211180515@csu.edu.cn ''' def remove(n, digit): ''' >>> remove(231, 3) 21 >>> remove(243123, 2) 4313 ''' kept, digits = 0, 0 # digits 记录当前位数 while n > 0: ...
# coding=utf-8 class App: TESTING = True SQLALCHEMY_DATABASE_URI = 'mysql://lvye_pay:p@55word@127.0.0.1:3306/lvye_pay' SQLALCHEMY_ECHO = True class Biz: VALID_NETLOCS = ['test_pay.lvye.com:5100'] HOST_URL = 'http://test_pay.lvye.com:5100' CHECKOUT_URL = 'http://dev_pay.lvye.com:5102/checkout/{sn}'...
# 1 grafo = [ { "vertice": 'a', "arestas": ['c', 'd', 'f'] }, { "vertice": 'b', "arestas": ['d', 'e'] }, { "vertice": 'c', "arestas": ['a', 'f'] }, { "vertice": 'd', "arestas": ['a', 'b', 'e', 'f'] }, { "vertice": 'e', "arestas": ['b', 'd'] }, { "vertice...
thinkers = ['Plato','PlayDo','Gumby'] while True: try: thinker = thinkers.pop() print(thinker) except IndexError as e: print("We tried to pop too many thinkers") print(e) break
# Time Complexity : O(n) ; Space Complexity : O(n) # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode: nodes = set() while...