content
stringlengths
7
1.05M
# Features used in this test: #https://www.openstreetmap.org/way/316623706 #https://www.openstreetmap.org/way/343269426 #https://www.openstreetmap.org/way/370123970 #https://www.openstreetmap.org/way/84422829 #https://www.openstreetmap.org/way/316623706 #https://www.openstreetmap.org/way/343269426 #https://www.openstre...
def ex041(): nascimento = int(input('Ano de nascimento:\n')) ano_atual = 2021 idade = ano_atual - nascimento print(f'O atleta tem {idade} anos') if idade <= 9: classi = 'MIRIM' elif idade > 25: classi = 'MASTER' elif idade <= 14: classi = 'INFANTIL' elif idad...
class MasterList: data = [0] # wszystkie bity BER = 0 # suma liczb przekłamanych E = 0 # dane ktore byly dobrze przeslane ReceivedBits = 0 # wszyskie proby przeslania danych do obliczen SizeOfWindow = 0 # wielkosc okna typeOfProtocol = 0 typeOfCode = 0 propability = 0 # prawdopodobiens...
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # Maintainer: Jonathan Lange """ Asynchronous unit testing framework. Trial extends Python's builtin C{unittest} to provide support for asynchronous tests. Maintainer: Jonathan Lange Trial strives to be compatible with other Pyth...
#symbol symbol = { 'PAD': 0, 'A': 1, 'T': 2, 'C': 3, 'G': 4, 'LOST': 5, 'CLS': 6, 'MASK': 7 } vocab_size = len(symbol) #pre-train embed_len = 256 context_len = 512 lm_input_len = 2 * context_len + 2 drop_1_prob = 0.1 drop_1_ratio = 0.2 drop_x_prob = 0.15 drop_x_ratio = 0.4 lm_heads_nu...
report = { "Water": 300, "Milk": 200, "Coffee": 100, "Money": 0, } prices = { "espresso": 1.50, "latte": 2.50, "cappuccino": 3.00, } ingredients = { "espresso": {"Water": 50, "Coffee": 18,}, "latte": {"Water": 200, "Coffee": 24, "Milk": 150,}, "cappuccino": {"Water": 250, "Coff...
class IncompatibleStateToRuleException(RuntimeError): def __init__(self): RuntimeError.__init__(self, "State incompatible to any rule from grammar.")
class NoOpTrainer(object): def train(self,batcher,dir,dev_batcher): pass
""" """ load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") load("@bazelrio//:deps.bzl", "setup_bazelrio_dependencies") load("@rules_jvm_external//:defs.bzl", "maven_install") load("@rules_pmd//pmd:toolchains.bzl", "rules_pmd_toolchains") load("@rules_python//python:pip.bzl", "pip_install"...
SERIES_URL = 'https://api.themoviedb.org/3/tv/popular?language=en-US' GENRE_SERIES_URL = 'https://api.themoviedb.org/3/genre/tv/list?language=en-US' GENRE_MOVIES_URL = 'https://api.themoviedb.org/3/genre/movie/list?language=en-US' paramAPI = '&api_key=' paramPage = '&page='
""" A jyotiSha computation package! A note on time: We internally use julian dates in the UTC time scale (See wiki article: https://en.wikipedia.org/wiki/Time_standard ). This is different from the Terrestrial time (TT), which contuines from the former Ephemeris time(ET) standard. Note on swiss ephemeris API: Please ...
# See http://webpython.codepoint.net/mod_python_publisher_uri_traversal s = """\ <html><body> <h2>Hello %s!</h2> </body></html> """ def index(): return s % 'World' def everybody(): return s % 'everybody'
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 19-1-3 下午10:43 # @Author : yangsen # @Mail : 0@keepangry.com # @File : word_cut.py # @Software: PyCharm """ 数据集:http://sighan.cs.uchicago.edu/bakeoff2005/ 1、生成样本 character_tagging.py 2、训练模型 3、给模型输入 character_split.py 4、模型输出 转化为分词结果 character_2_word.py ...
class numtup(tuple): def __add__(self, other): if isinstance(other, tuple): assert len(self) == len(other) return numtup(lhs + rhs for lhs, rhs in zip(self, other)) return numtup(lhs + other for lhs in self) def __mul__(self, other): if isinstance(other, tuple): ...
# FIND THE DUPLICATE NUMBER LEETCODE SOLUTION: # creating a class. class Solution(object): # creating a function to solve the problem. def findDuplicate(self, nums): # creating an iterable set. elements = set() # creating a for-loop to iterate for the elements in the list....
# -*- coding: utf-8 -*- # This Python file uses the following encoding: utf-8 """ > db.persons.findOne() { "_id" : "P_55", "name" : "Anna Margaretha* /Falkengren/", "sex" : "F", "grpNameGiven" : "704 6942", "grpNameLast" : "4419", "death" : { "date" : "17640827", "source" : "*1 Klinte CI:2, Sidan 195", ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"read_headers": "03_convert_files.ipynb", "parse_header_line": "03_convert_files.ipynb", "restore_header": "03_convert_files.ipynb", "read__write_from_sep_sv": "03_convert_files.ipy...
class Solution: @staticmethod def longest_palindromic(s: str) -> str: pass def expandAroundCenter (s, left, right): while left >= 0 and right < len(s) and s[left] == s[right]: left -=1 right +=1 return s[left+1:right] longestSub ...
""" Count the number of prime numbers less than a non-negative number, n. """ class Solution(object): def countPrimes(self, n): """ :type n: int :rtype: int """ if n < 2: return 0 sieve = [True] * n sieve[0] = False sieve[1] = False ...
# PROGRESSÃO ARITMÉTICA com while v2.0 print('=' * 44) print('{:^44}'.format(' PROGRESSÃO ARITMÉTICA ')) print('{:^44}'.format('Exibindo os dez primeiros termos de uma PA')) print('=' * 44) a1 = int(input('Primeiro termo: _ ')) r = int(input('Razão: _ ')) an = a1 # enésimo termo (inicia igual ao primeiro) a = [] ...
# # PySNMP MIB module PET-EVENTS (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PET-EVENTS # Produced by pysmi-0.3.4 at Wed May 1 14:40:13 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:...
andres = { "nombre": "Andres", "apellido": "Velasco", "edad": 22, "sueldo": 1.01, "hijos": [], "casado": False, "lotera": None, "mascota": { "nombre": "Cachetes", "edad": 3, }, } if andres: print("Si") else: print("No") print(andres['nombre']) print(andres['...
#PALAVRAS_CHAVE1 for i in palavras_chave1: count = sum(1 for _ in re.finditer(r'\b%s\b' % re.escape(i), curriculum.lower())) if count > 0: pc_1_x.append(i) pc_1_y.append(count) #print(i, 'count:', count) plt.figure() plt.plot(pc_1_x, pc_1_y) plt.xlabel('Palavras-chave') plt.ylabel('Apar...
def aumentar (n=0,p=0): v = n*(1+p/100) return v def diminuir (n=0,p=0): v = n*(1-p/100) return v def dobro(n=0): v=n*2 return v def metade (n): v=n/2 return v def moeda (preço=0, moeda='R$'): return f'{moeda}{preço:>.2f}'.replace('.',',')
class Listened: def __init__(self, times): self.times = times def params_str(self): return "{{times: '{}'}}".format(self.times)
''' Question 03: Write code in python to print various datatypes of variable x. My Solution: ''' a = "fruits" b = 20 c = 20.5 d = 1j e = ["apple", "orange", "pomegranate"] f = ("banana", "strawberry", "grape") g = range(8) h = {"pomegranate" : "fruit", "class" : "flora" } i = {"kiwi", "dragon fruit", "cu...
VARS_COMMAND = 'command' VARS_SUBCOMMAND = 'subcommand' VARS_DEFAULT = 'default' API_BASE_URL = 'https://api.epsagon.com'
class Pessoa: #Atributos def __init__(self, nome="Pessoa", idade=0 , altura=0.0 , peso=0): self.nome = nome self.idade = idade self.altura = altura self.peso = peso #Metodos def crescer(self, cm): self.altura += cm / 100 print("{} cresceu {} cm, e...
''' An object class for a value of a parameter. ''' class Value: def __init__(self, p, v): self.param_name = p self.value = v self.visited = False self.visited_num = 0
parentToChildrenBags = {} with open("C:\\Privat\\advent_of_code20\\puzzle7\\input1.txt") as f: for line in f: line = line.strip() print(line) lineSplit = line.split('contain') startingColorSplit = lineSplit[0].split(' ') startingColor = startingColorSplit[0] + ' ' + startin...
def main() -> None: # fermat's little theorem n, k, m = map(int, input().split()) # m^(k^n) MOD = 998_244_353 m %= MOD print(0 if m == 0 else pow(m, pow(k, n, MOD - 1), MOD)) # k^n % (MOD - 1) might be 0. # 0^0 is defined as 1 in Python. # but if m == 0, answer shoud be ...
lista = ['99', '102', '89', '120', '117'] cont = 0 maximo = lista[1] while cont < 3: if lista[cont] > lista[cont+1]: maximo = lista[cont+1] cont = cont + 1 print(maximo)
logo = """ ___________ __ .__ __________ \__ ___/_ __________/ |_| | ____ \______ \_____ ____ ____ | | | | \_ __ \ __\ | _/ __ \ | _/\__ \ _/ ___\/ __ \ | | | | /| | \/| | | |_\ ___/ | | \ / __ \\ \__\ ___/ |____| ...
def calculateHandlen(hand): """ Returns the length (number of letters) in the current hand. hand: dictionary (string int) returns: integer """ result = 0 for item in hand.keys(): result += hand[item] return result hand = {'h':1, 'e':1, 'l':2, 'o':1} print(calculateHandlen(...
t = int(input()) for _ in range(t): fib = [1,1] n = int(input()) if n == 1: print('IsFibo') else: while n > fib[1]: fib.insert(2, fib[0] + fib[1]) fib.remove(fib[0]) if fib[1] == n: print('IsFibo') else: print('IsNotFibo')
def g(x): b = 0 i = 1 while i < x: j = i + 1 while j <= x: b += gcd(i, j) j += 1 i += 1 return b def gcd(a, b): while not b == 0: a, b = b, a % b return a a = int(input()) while a: a = g(a) print(a) a = int(input())
class ExampleError(Exception): pass def bad_function(): raise ExampleError('this is a message', 1, 2, 'other1', 'other2', 'other3') try: bad_function() except ExampleError as err: message, x, y, *others = err.args print(f'[I] {message}') print(f'[I] Others: {others}')
# Created by MechAviv # Kinesis Introduction # Map ID :: 331001110 # Hideout :: Training Room 1 if "1" not in sm.getQuestEx(22700, "E1"): sm.lockForIntro() sm.playSound("Sound/Field.img/masteryBook/EnchantSuccess") sm.showClearStageExpWindow(350) sm.giveExp(350) sm.playExclSoundWithDownBGM("Voice...
""" Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, if it's parent node becomes a leaf node and has the value target, it should also be deleted (you need to continue doing that until you can't). ...
""" memory.py Represents a file memory. """ class Memory(): def write(self, line): f = open("results", "a") template = f"{line}\n" f.write(template) f.close()
USD = [ "amazon.com", "ebay.com", "newegg.com", ] EUR = [ "amazon.de" ] def get_currency(url): if url in USD: return "$" elif url in EUR: return "€" else: return "₺"
""" CONTINUAÇÃO... conjuntos.py """ # Assim como toda outra coleção Python podemos colocar tipos de dados misturados em sets s = {1, True, 'b', 34.42, 55} print(s) print(type(s)) # Podemos iterar em um set normalmente for valor in s: print(valor) # Usos interessantes com sets # Imagine que f...
#TheBestTimeToParty # celebrities Comes Goes # beyonce 6 7 # Taylor 7 9 # Brad 10 11 # Katy 10 12 # Tom 8 10 # Drake 9 11 # Alicia 6 8 # [6 7) <- notice that at 6:59, Beyo...
class Heap: def __init__(self, initial_size=10): self.cbt = [None for _ in range(initial_size)] # initialize arrays self.next_index = 0 # denotes next index where new element should go def insert(self, data): # insert element at the next index self.cbt[self.next_index] = data ...
class Solution: def specialArray(self, nums: List[int]) -> int: for i in range(len(nums) + 1): count = 0 for num in nums: if num >= i: count += 1 if count > i: break if count == i: ret...
#!/usr/bin/env python3 #Faça um programa que leia 5 números e informe o maior número. #Exemplo com FOR lista=[] for num in range(0,5,1): lista.append(int(input("Digite o número: "))) print("O maior número digitado é: "+str(max(lista))) #Exemplo com WHILE #lista=[] #while len(lista)<5: #lista.append(input("Di...
decoration_prices = { 'ornament set': 2, 'tree skirt': 5, 'tree garlands': 3, 'tree lights': 15, } quantity = int(input()) days = int(input()) total_spirit = 0 total_cost = 0 for day in range(2, days+1): if day % 11 == 0: quantity += 2 if day % 2 == 0: total_s...
# Leetcode 35. Search Insert Position # # Link: https://leetcode.com/problems/search-insert-position/ # Difficulty: Easy # Solution using BinarySearch # Complexity: # O(logN) time | where N represent the number of elements in the input array # O(1) space class Solution: def searchInsert(self, nums: List[int],...
def darken(hex_str: str, amount: int) -> str: rgb = hex_to_rgb(hex_str) rgb_result = tuple(map(lambda x: clamp(x - amount, 0, 255), rgb)) return rgb_to_hex(rgb_result) def hex_to_rgb(hex_str: str) -> tuple: hex_ = hex_str.lstrip('#') return tuple(int(hex_[i:i+2], 16) for i in (0, 2, 4)) def rgb_...
""" @Author: huuuuusy @GitHub: https://github.com/huuuuusy 系统: Ubuntu 18.04 IDE: VS Code 1.36 工具: python == 3.7.3 """ """ 思路: 注意补数的含义,采用二进制计算 结果: 执行用时 : 48 ms, 在所有 Python3 提交中击败了55.23%的用户 内存消耗 : 13.8 MB, 在所有 Python3 提交中击败了100%的用户 """ class Solution: def findComplement(self, num): return 2**(...
# spread # Manas Dash # 24th aug 2020 # Implements javascript's [].concat(...arr). Flattens the list(non-deep) and returns a list. def spread(arg): ret = [] for i in arg: if isinstance(i, list): ret.extend(i) else: ret.append(i) return ret print(spread([1, 2, 3, [4, 5, 6], [7], 8, 9])) print(spread(['Th...
# testnet_nanoswap_pools = {(77279127, 77279142): 77282939} # (asset1_id, asset2_id) -> app_id ASSET1_ID = 77279127 ASSET2_ID = 77279142 # Test UST asset # Set to zero to initialize a new test asset USTEST_ID = 0 # USTEST_ID = 85382910 # USTEST_ID = 80691763 # MetaPool App Id # Set to zero to initialize a new metapo...
quant_atual = int(input('Quanto desse produto temos?')) quant_max = 95 quant_min = 10 quant_media = ((quant_max + quant_min)/2) if quant_atual >= quant_media: print('Não efetuar compra') else: print('Efetuar compra')
num = int(input()) isHave = False for i in range(1, 31): for j in range(1, 31): for k in range(1, 31): if i < j < k: sum = i + j + k if sum == num: print(f'{i} + {j} + {k} = {sum}') isHave=True if i > j > k: ...
class MOD(object): """ mod K 上の演算ライブラリ """ def __init__(self, modulo: int): self.modulo = modulo self.size = 2 self.fact = [1, 1] self.inv = [1, 1] self.finv = [0, 1] def comb(self, n: int, k: int) -> int: """ nCk (組み合わせ) を求める """ if n...
expected_output = { "license_usage": { "network-premier_5G": { "entitlement": "ESR_P_5G_P", "count": "1", "status": "IN USE" }, "dna-premier_5G": { "entitlement": "DNA_P_5G_P", "count": "1", "status": "IN USE" }, "hseck9": { ...
class Node: def __init__(self, label, before, after): self.label = label self.before = before self.after = after def __repr__(self): return f'{self.label}' # Build the circular list line = input() first = Node(int(line[0]), None, None) last = first for label in line[1:]: n...
# Crie um programa onde o usuário possa digitar vários valores numéricos e cadastre-os em uma lista. Caso o número já exista lá dentro, ele não será adicionado. No final, serão exibidos todos os valores únicos digitados, em ordem crescente. valores = [] while True: num = int(input('Digite um valor: ')) if num...
class HJ(): def __init__(self, val, n,i): self.g = [0.0]*n self.g[i] = 1.0 self.f = val class Parametrization(): def __init__(self): self.parameters = {} self.variable_indices = {} def add_parameter(self, key, value, is_variable=False): if key in se...
{ 'targets': [{ 'target_name': 'yatm', 'sources': [ 'src/yatm.cc', 'src/image.cc', 'src/transform.cc' ], 'include_dirs': [ '<!(node -e "require(\'nan\')")', 'deps/include/glib-2.0', 'deps/include', 'd...
# https://leetcode.com/problems/3sum/ # Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? # Find all unique triplets in the array which gives the sum of zero. # # Note: # The solution set must not contain duplicate triplets. # # Example: # Given array nums = [-1, 0, 1, 2, -...
string = list(input()) print(string) arr_alpha = ['a', 'b', 'c', 'd', 'e', 'f','g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] arr_index = [-1] * 26 for char in string: arr_index[arr_alpha.index(char)] = string.index(char) for i in arr_index: print(i, end='...
#!/usr/bin/python3 # -*- coding: utf-8 -*- def str0(n): return str(n) if n > 9 else '0%s' % n def strh(t): return '%s:%s' % ( str0(int(t/60)), str0(t % 60) )
class Address: def __init__(self): self.city: str = "" self.street: str = "" self.telephone: str = "" @classmethod def from_xml(cls, node): address = cls() address.init_from_xml(node) return address def init_from_xml(self, node): self.city = node...
#Number to Day Translation Days = { 0: {"Name": "Pondělí"}, 1: {"Name": "Úterý"}, 2: {"Name": "Středa"}, 3: {"Name": "Čtvrtek"}, 4: {"Name": "Pátek"}, 5: {"Name": "Pondělí"}, #Should be "Sobota" or "Saturday", but using "Monday" since embeds skip weekends 6: {"Name": "Úterý"} #Should be "Neděle" or "Sunday", but...
def acronym_buster(message): acronyms = { 'CTA': 'call to action', 'EOD': 'the end of the day', 'IAM': 'in a meeting', 'KPI': 'key performance indicators', 'NRN': 'no reply necessary', 'OOO': 'out of office', 'SWOT': 'strengths, weaknesses, opportunities and t...
# -*- coding: utf-8 -*- """Top-level package for PyPITest.""" __author__ = """Wanhu Tang""" __email__ = 'test@test.com' __version__ = '0.1.0'
class Parser: def __new__(self, args: str = None): r = {} if args is None: r['status'] = None else: r['status'] = True if len(args.split(' ')) == 1: r = { 0: args } else: ...
class Solution: def maximumProduct(self, nums): nums.sort() a, b, c = nums[:3] # 前三个 e, d, f = nums[-3:] # 后三个 return max(e * d * f, a * b * f) slu = Solution() print(slu.maximumProduct([1, 2, 2, 3]))
{ "targets": [ { "target_name": "diskfree", "sources": [ "./src/disk-gyp.cpp", "./src/disk.cpp" ], }, ], }
rolls = input().split() sum_dict = dict() max = 0 for i in range(1, int(rolls[0]) + 1): for j in range(1, int(rolls[1]) + 1): sum = i + j if sum not in sum_dict: sum_dict[sum] = 0 else: sum_dict[sum] += 1 if sum_dict[sum] > max: ...
VOTING_MAJORITY = 0.51 CONSENSUS_TYPES = { 0: '0: kick', 1: '1: make admin', 2: '2: revoke admin', 3: '3: add longevity', 4: '4: remove longevity' }
class Data: def __init__(self, data_string): self.data_string = data_string @classmethod def data_format(cls, data): try: cls.my_data = list(map(int, data.split('-'))) print(cls.my_data) except ValueError: print("В дате должны быть только цифры") ...
class TrayError(Exception): def __init__(self, value, caller=None): self.value = value self.caller = caller def __str__(self): return repr(self.value) class NoObservationError(TrayError): pass class NoUndoError(TrayError): pass class PropertyNotFoundError(TrayErro...
"""Switch between Google or open source dependencies.""" # Switch between Google and OSS dependencies USE_OSS = True # Per-dependency switches determining whether each dependency is ready # to be replaced by its OSS equivalence. # TODO(danmane,mrry,opensource): Flip these switches, then remove them OSS_APP = True OSS_...
"""This is the starting point for a Python package. """ __version__ = '0.0.1'
class Solution(object): def restoreIpAddresses(self, s): """ :type s: str :rtype: List[str] """ return self.restoreHelper(s, 0, len(s)) def restoreHelper(self, s, index, length, string="", dot=0): result = [] if dot == 3: if i...
def knapsack(items, maxweight): N = len(items) W = maxweight bestvalues = [[0] * (W + 1) for i in range(N + 1)] for i, (value, weight) in enumerate(items): for capacity in range(maxweight + 1): if weight > capacity: bestvalues[i + 1][capacity] = ...
def getHeadWord(): return { "Work": ["(Work|WORK)", "(WORK EXPERIENCE|Experience(s?)|EXPERIENCE(S?))", "(History|HISTORY)", "(Projects|PROJECTS)"], "Education": ["(Education|EDUCATION)", "(Qualifications|QUALIFICATIONS)"], "Skills": [ "(Skills|SKILLS)", "(Proficiency|...
# # PySNMP MIB module ASCEND-SDSL-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-SDSL-MIB # Produced by pysmi-0.3.4 at Wed May 1 11:29:09 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27...
''' Kattis - powereggs Actually a hard problem, but we read the explanation in CP4 to get this super efficient solution that runs in O(32*k). Time: O(32k), Space: O(1)''' def f(d, k): # number of floors we can determine with d drops and k eggs ans = 0 cur = 1 # d choose i for i in range(1, k+1): ...
class DictPopper: def __init__(self, d): self.__d = d self.__data = dict() def __iter__(self): def f(pair): return self.__d.pop(*pair) return map(f, self.__data.items()) def add(self, key, default = None, spreadKey = False): for k in (key, ) if not spreadKe...
def isPalindrome(x: int): if str(x) == str(x)[::-1]: return True else: return False print(isPalindrome(20011002))
def multiply_list(start, stop): product = 1 for element in range(start, stop): product = product * element return product x = multiply_list(1, 4) print(x)
''' Solution 1: Let sum[i] = Sum of all subsequences containing element n[i] with any of the previous elements. Let num[i] = Number of subsequences from 0 till i inclusive = 2^(i+1) sum[i] = sum[i-1] + num[i-1] * n[i] (Since we can append n[i] to all the num[i-1] sequences) sum[i] = sum[i-1] + 2^(i) * n[i] ans[i] = ans...
# This class is an object blueprint for all video content class Video(): def __init__(self, title, duration, rating): """Video class - Normally subclassed""" #constructor self.title = title self.duration = duration self.rating = rating
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == "__main__": str1 = str(input('Введите что-нибудь --> ')).lower() str2 = str(input('Введите что-нибудь ещё раз --> ')).lower() common_letters = set(str1) & set(str2) print(common_letters)
class WorksheetExt: def __init__(self, worksheet): self.worksheet = worksheet self.row = 0 self.is_pvs = False def row_inc(self): self.row += 1 def get_row(self): return self.row def is_pvs_added(self): return self.is_pvs def add_header_row(self, h...
class Solution: """ @param ratings: Children's ratings @return: the minimum candies you must give """ def candy(self, ratings): if not ratings: return 0 pre_rating = ratings[0] now_candy = 1 left2right_candies = [now_candy] for ra...
# # PySNMP MIB module LBHUB-ECS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/LBHUB-ECS-MIB # Produced by pysmi-0.3.4 at Wed May 1 14:05:59 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 201...
num1 = 10 num2 = 20 num3 = 3838 num3 = 30 num4 = 40
''' Module provides tracking for Derrida's library, its works, and associated instances of those works. It also services as a hub for links between physical copies and their digital representations in the Django admin. ''' default_app_config = 'derrida.books.apps.BooksConfig'
#MaBe def linhas(titulo): print("-" * (len(titulo)+4)) print(f' {titulo}') print("-" * (len(titulo)+4)) linhas('Olá, Mundo!')
# pylint: disable=R0903 (too-few-public-methods) class CorsMiddleware: def __init__(self, get_response): self.get_response = get_response def __call__(self, req): response = self.get_response(req) response["Access-Control-Allow-Origin"] = "*" response["Access-Control-Allow-Heade...
""" In this sheet searching algorithms are placed: Binary Search -> to find an element in a sorted array Quick Select -> to find kth smallest element in the array Search In Sorted Matrix -> to find an element in a sorted matrix """ # Common binary search: # Find a target in a sorted array. # Time O(log(N))...
# # PySNMP MIB module ORADB-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ORADB-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:26:18 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:23...
# Exercício 13 lista 1 print("--------Calcula o gasto total da granja para identificar todos os frangos-----------") qtdFrangos = int(input("Digite a quantidade de frangos:")) chipAlimentacao = float(input("Digite o valor do chip alimentação:")) chipIdentidade = float(input("Digite o valor do chip identificação:")) ...
def checkio(number: int) -> int: if number < 10: return number elif number % 10 == 0: return checkio(number // 10) else: return checkio(number // 10) * (number % 10 ) #These "asserts" using only for self-checking and not necessary for auto-testing if __name__ == '__main__': ...
# A binary gap within a positive integer N is any maximal sequence of consecutive zeros # that is surrounded by ones at both ends in the binary representation of N. # # For example, number 9 has binary representation 1001 and contains a binary gap of length 2. # The number 529 has binary representation 1000010001 an...
# # PySNMP MIB module IPMS-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPMS-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:56:09 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:23:1...