content
stringlengths
7
1.05M
# Python - 3.6.0 Test.describe('thirt') Test.it('Basic tests') Test.assert_equals(thirt(8529), 79) Test.assert_equals(thirt(85299258), 31) Test.assert_equals(thirt(5634), 57) Test.assert_equals(thirt(1111111111), 71) Test.assert_equals(thirt(987654321), 30)
class HistMovementManager: def __init__(self): self.boards_hist = [] self.cur_board = -1 self.offset = 0 def make_screen(self, board): if self.cur_board != -1 and self.boards_hist[self.cur_board] == board: return self.boards_hist.append(board) self.c...
""" """ def map_int(to_int) -> int: """Maps value to integer from a string. Parameters ---------- to_int: various (usually str) Value to be converted to integer Returns ------- mapped_int: int Value mapped to integer. Examples -------- >>> number_one = "1" ...
# -*- coding: utf-8 -*- """ defs_newton defines e constantes válidas localmente revision 0.2 2015/nov mlabru pep8 style conventions revision 0.1 2014/out mlabru initial release (Python/Linux) """ # < enums >---------------------------------------------------------------------------------------- # estado operaci...
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- __all__ = [ "functions", "dbcontent", "sqlite_helper", "global_variable" ]
def distributeCoins(self, root: TreeNode) -> int: num_opt = 0 def dfs(node): """ >>> DFS Traverse the tree, for each node, the number of moves is the absolute values between 1 and the left/right node values. Also remember to update...
# Copyright 2020 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
float_type = type(1.0) int_type = type(1) string_type = type('') date_type = 'iso8601' unicode_type = type(u'') bool_type = type(True) map_type = type({}) seq_type = type([]) tuple_type = type(()) def is_string(obj): t = type(obj) return t is string_type or t is unicode_type def is_int(obj): return type(o...
class Field(object): sql_type = None py_type = None def __init__(self, name=None, value=None, pk=None, unique=None, not_null=None): self.name = name self.pk = pk self.unique = unique self.not_null = not_null self.value = value def set_name(self, name): ...
# Copyright 2018 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# cypher.py - encrypt and decrypt messages def cypher(message, key): result = "" for ch in message: ch = chr(ord(ch) ^ key) result += ch return result def run(): plaintext = input("message? ") key = input("hex number for key? ") key = int(key, 16) cyphertext = cypher(plain...
"""Constants for the Automate Pulse Hub v2 integration.""" DOMAIN = "automate" AUTOMATE_HUB_UPDATE = "automate_hub_update_{}" AUTOMATE_ENTITY_REMOVE = "automate_entity_remove_{}"
""" The parsed output of the knowledge,json is used to create the Knowledge object consisting of the target and rules """ class Rule: """ Class to store the rule in the string format Attributes ----------- __rule: str rule for the knowledge """ def __init__(self, rule: str): ...
__all__ = [ 'q1_itertools_product', 'q2_itertools_permutations', 'q3_itertools_combinations', 'q4_itertools_combinations_with_replacement', 'q5_compress_the_string', 'q6_iterables_and_iterators', 'q7_maximize_it' ]
# This file is part of LibCSS. # Licensed under the MIT License, # http://www.opensource.org/licenses/mit-license.php # Copyright 2017 Lucas Neves <lcneves@gmail.com> # Configuration of CSS values. # The tuples in this set will be unpacked as arguments to the CSSValue # class. # Args: see docstring for class CSSValue ...
class CSharpReference(): def __init__(self,): self.reference_object = None self.line_in_file = -1 self.file_name = ''
# -*- coding: utf-8 - # # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. version_info = (20, 0, 4, "custom") __version__ = ".".join([str(v) for v in version_info]) SERVER = "gunicorn" SERVER_SOFTWARE = "%s/%s" % (SERVER, __version__)
''' 03 - Creating histograms Histograms show the full distribution of a variable. In this exercise, we will display the distribution of weights of medalists in gymnastics and in rowing in the 2016 Olympic games for a comparison between them. You will have two DataFrames to use. The first is called mens_rowing and ...
"""camera_settings.py Note: Currently not used. Proof of concept to show how to change camera settings in one file and have them applied to a camera from a different script. """ def apply_settings(camera): """Changes the settings of a camera.""" camera.clear_mode = 0 camera.exp_mode = "Internal T...
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='MixVisionTransformer', in_channels=3, embed_dims=32, num_stages=4, num_layers=[2, 2, 2, 2], num_heads=[1, 2, 5, 8], ...
# how to create a function def greet(): print("Hello") print("welcome, Edgar") greet() # prints greet() # prints(2) greet() # prints(3) # arguments and parameters def greet(name): # name is a parameter print('hello') print('welcome, ', name) greet('Edgar') # Edgar is the argument # return def greet(n...
#! /usr/bin/env python3 """ constants.py - Contains all constants used by the device manager Author: - Nidesh Chitrakar (nideshchitrakar@bennington.edu) - Hoanh An (hoanhan@bennington.edu) Date: 12/07/2017 """ number_of_rows = 3 # total number rows of Index Servers number_of_li...
def convert_date_string_to_period(timestamp) -> int: try: month = int(timestamp.month) except AttributeError: return -1 else: return month
exe = "tester.exe" toolchain = "msvc" # optional link_pool_depth = 1 # optional builddir = { "gnu" : "build" , "msvc" : "build" , "clang" : "build" } includes = { "gnu" : [ "-I." ] , "msvc" : [ "/I." ] , "clang" : [ "-I." ] } defines = { "gnu" : [ "-DEXAMPLE=1" ] , "msvc" : [ "/DEX...
# Problem: https://www.hackerrank.com/challenges/alphabet-rangoli/problem def print_rangoli(size): alorder = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' alorder = ''.join([i.lower() for i in alorder]) string, width , side_l, side_str = alorder[:size], (size-1)*4+1, [], '' # top half for i in range(size-1): ...
# Cooling Settings cool_circuit = \ {'label': 'Activate Cooling:', 'value': True, 'sticky': ['NW', 'NWE'], 'sim_name': ['stack', 'cool_flow'], 'type': 'CheckButtonSet', 'specifier': 'checklist_activate_cooling', 'command': {'function': 'set_status', 'args': [[[1, 0], [1, 1], [1, 2],...
class Solution: # @param {integer} n # @param {integer} k # @return {string} def getPermutation(self, n, k): nums = [i+1 for i in xrange(n)] facts = [0 for i in xrange(n)] facts[0] = 1 for i in range(1,n): facts[i] = i*facts[i-1] k = k-1 res = ...
# Python 3 compatibility (no longer includes `basestring`): try: basestring except NameError: basestring = str class Item(object): '''Common logic shared across all kinds of objects.''' class UnknownAttributeError(ValueError): def __init__(self, attributes): super(Item.UnknownAttr...
word = input().lower() ans = [] vowels = ('a', 'i', 'u', 'e', 'o', 'y') filtered_word = word for i in word: if i in vowels: filtered_word = filtered_word.replace(i, "") for i in filtered_word: ans.append('.') ans.append(i) print(''.join(ans))
def ft_map(function_to_apply, list_of_inputs): return [function_to_apply(x) for x in list_of_inputs] c = [0,1,2,3,4,5] def add1(t): return t+1 print(list(map(lambda x: x+1,c))) print(ft_map(lambda x: x+1,c))
#!/bin/python2.7 #CLASS PARA VERIFICAR OS GRUPOS DE CONFLITO class ScdGrupoConflito(object): def __init__(self): self.in_port = False self.ip_src = False self.ip_dst = False self.dl_src = False self.dl_dst = False self.tp_src = False self.tp_dst = False ...
def get_slice_length(path): for i in range(len(path)): if path[i].isalpha(): return i return -1
entrada = int(input()) #resultado = entrada % 2 #comp = 10 % 2 i = 1 while i <= entrada: if i % 2 != 0: print(i) i+= 1
""" # Supported expressions examples Test for `handsdown.ast_parser.analyzers.expression_analyzer.ExpressionAnalyzer` test. """ # string example STRING = "string" # bytes example BSTRING = b"string" # r-string example RSTRING = r"str\ing" # joined string example JOINED_STRING = "part1" "part2" # f-string example ...
class ModaError(Exception): pass class ModaTimeoutError(ModaError): pass class ModaCannotInteractError(ModaError): pass
def bubblesort(a_list: list) -> list: """ The Bubble sort algorithm is the most naive one that we can create. The idea around this algorithm is comparing each two elements on the list and swapping them in case one is bigger than the other. If any swap is executed, we need to rerun it, since these swapp...
def recurse(a,i): if i == len(a)-1: print(a[i]) return else: recurse(a,i+1) print(a[i]) recurse([1,2,3,4,5],0)
# https://www.hackerrank.com/challenges/30-running-time-and-complexity/problem # Trial division def is_prime(n): if n < 2: return False i = 2 while i * i <= n: if n % i == 0: return False i += 1 return True if __name__ == '__main__': n, nums = int(input()), [] ...
class Citation: """Basic citation class""" def __init__(self, data: dict): self.data = data @property def data_(self): return self.data def __str__(self): return str(self.data) def __repr(self): return str(self.data)
def encode1(Loan_Status): """ This function encodes a loan status to either 1 or 0. """ if Loan_Status == 'Y': return 1 else: return 0 def encode2(Gender): """ This function encodes a loan status to either 1 or 0. ...
bulan_pembelian = ('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember') pertengahan_tahun = bulan_pembelian[4:8] print(pertengahan_tahun) awal_tahun = bulan_pembelian[:5] print(awal_tahun) akhir_tahun = bulan_pembelian[8:] print(akhir_tahun) print(bu...
def test_one(app): response = app.get('/api/services', status=200) response.json.should.be.is_instance(list) def test_two(app): response = app.get('/api/services/1', status=200) response.json.should.be.equal({'id': 9, 'name': 'Voice', 'slug': 'SERVICE_VOICE'})
def str_to_int(value, default=int(0)): stripped_value = value.strip() try: return int(stripped_value) except ValueError: return default def str_to_float(value, default=float(0)): stripped_value = value.strip() try: return float(stripped_value) except ValueError: ...
k=1 suma=(k**2+1)/k cont=0 while cont<1000: cont+=suma print(k) k+=1 suma=(k**2+1)/k
# Copyright 2017-2021 object_database Authors # # 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 ...
class JSException(Exception): """Base exception for javascript engine wrapper.""" pass class ArgumentError(JSException): pass class JSFunctionNotExists(JSException): pass class JSRuntimeException(JSException): """Javascript runtime exception with a stacktrace.""" def __init__(self, msg, ...
# encoding=utf8 # coding=UTF-8 #pastaArquivoCsv = "/home/00937325465/familiai/acompanhaig/arquivos/csv/" #pastaArquivoCsvProc = "/home/00937325465/familiai/acompanhaig/arquivos/csv/processados/" #pastaArquivoZip = "/home/00937325465/familiai/acompanhaig/arquivos/zip/" #pastaArquivoZipProc = "/home/00937325465/famili...
class Innovation: def __init__(self, innov, new_conn, fr=None, to=None, node_id=None): """Innovation details Args: innov (int): Innovation ID of the Innovation new_conn (bool): Is the new Innovation a innovation of a connection or a node fr (int, optional): Node ...
def slices(number, n): initial, res = 0, [] if n > len(number) or n == 0: raise ValueError("Desired slices greater than number length") elif n == len(number): return [[int(x) for x in number]] elif n == 1: return [[int(x)] for x in number] else: while n <= len(number)...
# # PySNMP MIB module HUAWEI-LswSMON-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-LswSMON-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:34:34 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, ...
""" Copyright 2015, Rob Shakir (rjs@jive.com, rjs@rob.sh) This project has been supported by: * Jive Communcations, Inc. * BT plc. 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 a...
INPUTS = [ ['Select', False], ['Signal Only', ''], ['Probe', 'motion.probe-input'], ['Digital In 0', 'motion.digital-in-00'], ['Digital In 1', 'motion.digital-in-01'], ['Digital In 2', 'motion.digital-in-02'], ['Digital In 3', 'motion.digital-in-03'], ] OUTPUTS = [ ['Select', False], ['Signal Only', ''], ['C...
# -*- coding: utf-8 -*- ################################################################################ # Author : SINAPSYS GLOBAL SA || MASTERCORE SAS # Copyright(c): 2019-Present. # License URL : AGPL-3 ################################################################################ { 'name': 'Comprobantes...
n=int(input()) d=2 i = 0 while n>d : if n%d==0 : i+=1 print ("divisible by",d, "and count",i) else: print ("not divisible by this number",d) d+=1
# -*- encoding: utf-8 -*- EPILOG = 'Docker Hub in your terminal' DESCRIPTION = 'Access docker hub from your terminal' HELPMSGS = { 'method': 'The api method to query {%(choices)s}', 'orgname': 'Your orgname', 'reponame': 'The name of repository', 'username': 'The Docker Hub username', 'format': 'You can dispaly re...
adj = [[False for i in range(10)] for j in range(10)] result = [0] def findthepath(S, v): result[0] = v for i in range(1, len(S)): if (adj[v][ord(S[i]) - ord('A')] or adj[ord(S[i]) - ord('A')][v]): v = ord(S[i]) - ord('A') elif (adj[v][ord(S[i]) - ord('A') + 5] or ...
print('Olá, Mundo!') #seguindo a sintaxe vc pode digitar o que quiser; #outra opção: msg = 'Olá, Mundo!' print(msg)
# Create a program that reads a positive integer N as input and prints on the console a rhombus with size n: def generate_pyramid(size: int, inverted: bool = False) -> list: steps = [i for i in range(1, size + 1)] if inverted: steps.reverse() return [' ' * (size - i) + '* ' * i for i in steps] d...
# Copyright 2021 Denis Gavrilyuk. 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 law ...
#!/usr/bin/env python3 # ~*~ coding: utf-8 ~*~ # Write a program that has a user guess your name, but they only get 3 # chances to do so until the program quits. print("Try to guess my name!") count = 1 name = "guileherme" guess = input("What is my name? ") while count < 3 and guess.lower() != name: # . lower allows th...
def minimumDistances(a): min_distance = -1 length = len(a) for number in range(0, length-1): for another_number in range(number+1, length): if a[number] == a[another_number]: distance = another_number - number if min_distance == -1: min...
class Parser: """ Parse string matrix and covert each entry to double value, skipping nan values""" def parse(self, matrix): result = [] for row in range(0, len(matrix)): result.append([]) rowLength = len(matrix[row]) for col in range(0, rowLength): ...
'''Exercício Python 075: Desenvolva um programa que leia quatro valores pelo teclado e guarde-os em uma tupla. No final, mostre: A) Quantas vezes apareceu o valor 9. B) Em que posição foi digitado o primeiro valor 3. C) Quais foram os números pares.''' print('-'*40) num = (int(input('Digite um número: ')), int(input('D...
def calc_sum(*args): def lazy_sum(): s = 0 for n in args: s = s + n return s return lazy_sum f = calc_sum(1,3,5,7,9) def count(): fs = [] for i in range(1,4): fs.append(lambda i=i: i*i)# lambda函数简化 return fs f1,f2,f3 = count() print(f1(),f2(),f3())
# -*- coding: utf-8 -*- # # ax_spines.py # # Copyright 2017 Sebastian Spreizer # The MIT License def set_default(ax): set_visible(ax, ['bottom', 'left']) def set_visible(ax, sides): all_sides = ax.spines.keys() for side in all_sides: ax.spines[side].set_visible(side in sides) def set_invisible(a...
""" Pre-generation tasks. This is executed before the project has been generated. """ def main() -> int: """ Validate parameters. """ status = 0 if not "{{ cookiecutter.plugin_name }}": print("ERROR: plugin_name cannot be blank") status = 1 if not "{{ cookiecutter.author_name }}":...
''' https://www.codingame.com/training/easy/create-the-longest-sequence-of-1s ''' b = input() count = 0 buf = "0" zeros = [] ones = [] for i in range(len(b)): if b[i] == buf: count += 1 else: if buf == "0": zeros.append(count) else: ones.append(count) ...
#This program calculates how many tiles you #need when tiling a floor (in m2) length = float(input("Enter room length:")) width = float(input("Enter room width:")) area = length * width needed = area * 1.05 print("You need", needed, "tiles in squared metres")
t = int(input('Digite um número para ver sua tabudada: ')) print('-='*6) # o {:2} é pra deixar alinhadinho unidade com unidade e dezena com dezena print('{} * {:2} = {}'.format(t, 1, t*1)) print('{} * {:2} = {}'.format(t, 2, t*2)) print('{} * {:2} = {}'.format(t, 3, t*3)) print('{} * {:2} = {}'.format(t, 4, t*4)) pr...
# # PySNMP MIB module ZYXEL-CLUSTER-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-CLUSTER-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:49:17 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
# import math # def squareRoot(a): # return round(math.sqrt(float(a)),9) def squareRoot(a): return round(float(a)**(1/2),8)
class WesternDigitalRuleChecker(object): def __init__(self): self.estimated_value = 0 self.standard_deviation = 0 def __init__(self, estimated_value, standard_deviation): self.estimated_value = estimated_value self.standard_deviation = standard_deviation def check_rule_1(s...
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]: if not head: return None ...
#Crie um programa que simule o funcionamento de um caixa eletrônico. No inicio, pergunte ao usuário qual o valor sacado (número inteiro) e o #programa vai informar quantas cédulas de cada valor serão entregues.] #obs: Considere que o caixa possui cédulas de R$50,R$20,R$10 e R$1. print('Caixa Eletrônico') print('Cédula...
alist = [10, 20, 23, 26, 27, 35, 38, 41, 46, 49, 54, 56, 64, 70, 81, 87, 88, 90, 92, 96, 98] temp = None def binary_search(left: int, right: int, key: int) -> int: global temp if len(alist) == 1: if alist[left] == key: return alist[left] else: return 0 else: ...
class HTTPError(Exception): """Http Error Exception""" pass
# 2021 April 16. Surrendered entirely. # 2-d dp. # text1 = "abcba", text2 = "abcbcba" # At any two positions i, j in t1 and t2, if 1) t1[i] == t2[j] # then the length of common subsequence count should increment by 1 and # we then check from t1[i+1] and t2[j+1]. If 2) t1[i] != t2[j], then we # should keep on finding...
class PxLoadBar(object): """ Visualizes system load in a horizontal bar. Inputs are: * System load * Number of physical cores * Number of logical cores * How many columns wide the horizontal bar should be The output is a horizontal bar string. Load below the number of physical cor...
""" FizzBuzz is a classical interview question. We will implement a modified version of it, however, you can also find the original version on the web if you are interested. Write a program that takes a number from the user. If this number is negative, print an error message if this number is a multiple of 3, print '...
class BaseSensor(): def __init__(self): self.null_value = 0 self.sensor = None self.measurements = [] self.upper_reasonable_bound = 200 self.lower_reasonable_bound = 0 def setup(self): self.sensor = None def read(self): return None def average(s...
def time_in_range(data, bg_range=(4.0, 7.0)): # data[0] is the time values - assume they are equally spaced, so we can ignore values = data[1] return 100.0 * sum([bg_range[0] <= v <= bg_range[1] for v in values]) / len(values) def mean(data): values = data[1] return float(sum(values)) / len(values...
def maior_primo(x) -> object: for maior in reversed(range(1,x+1)): if all(maior%n!=0 for n in range(2,maior)): return maior
USER_CREATED = "user_created" USER_ADDED = "user_added_to_request" USER_REMOVED = "user_removed_from_request" USER_PERM_CHANGED = "user_permissions_changed" USER_STATUS_CHANGED = "user_status_changed" # user, admin, super USER_INFO_EDITED = "user_information_edited" REQUESTER_INFO_EDITED = "requester_information_edite...
# Find the sum of the numbers 8, 9, 10 # Var declarations num1 = 8 num2 = 9 num3 = 10 # Code sum = num1 + num2 + num3 # Result print(sum)
# Write your make_spoonerism function here: def make_spoonerism(word1, word2): a = word1[0] b = word2[0] c = word1[0].replace(a,b) + word1[1:] d = word2[0].replace(b,a) + word2[1:] e = c + ' ' + d return e # Uncomment these function calls to test your function: print(make_spoonerism("Codecademy", "Learn"...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"trace_log": "01_convert_time_log.ipynb", "format_value": "01_convert_time_log.ipynb", "strip_extra_EnmacClientTime_elements": "01_convert_time_log.ipynb", "unix_time_milliseconds":...
#Planetary database #Source for planetary data, and some of the data on #the moons, is http://nssdc.gsfc.nasa.gov/planetary/factsheet/ class Planet: ''' A Planet object contains basic planetary data. If P is a Planet object, the data are: P.name = Name of the planet P.a = Mean radius ...
palavras = {} arquivo = open('words.txt', 'r') for p in arquivo.readlines(): palavra = p.split(' ') for l in palavra: try: palavras[l] += 1 except: palavras[l] = 1 arquivo.close() print(palavras)
def getKey(dictionary, svalue): for key, value in dictionary.items(): if value == svalue: return key # def hasKey(dictionary, key): # if key in dictionary: # return True # return False
# https://www.codewars.com/kata/529872bdd0f550a06b00026e/ ''' Instructions : Complete the greatestProduct method so that it'll find the greatest product of five consecutive digits in the given string of digits. For example: greatestProduct("123834539327238239583") // should return 3240 The input string always has...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. def drop_view_if_exists(cr, viewname): cr.execute("DROP view IF EXISTS %s CASCADE" % (viewname,)) cr.commit() def escape_psql(to_escape): return to_escape.replace('\\', r'\\').replace('%', '\%').replace('_',...
""" You are given three inputs, all of which are instances of a class that have an "ancestor" property pointing to their youngest ancestor. The first input is the top ancestor in an ancestral tree(i.e. the only instance that has no ancestor), and the other two inputs are descendants in the ancestral tree. Write a funct...
@auth.route('/login', methods=['GET', 'POST']) # define login page path def login(): # define login page fucntion if request.method=='GET': # if the request is a GET we return the login page return render_template('login.html') else: # if the request is POST the we check if the user exist ...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"get_norm_stats": "00_utils.ipynb", "draw_rect": "00_utils.ipynb", "convert_cords": "00_utils.ipynb", "resize": "00_utils.ipynb", "noise": "00_utils.ipynb", "get_p...
tabela = ('Flamengo', 'Internacional', 'Atletico-MG', 'São Paulo', 'Fluminense', 'Gremio', 'Palmeiras', 'Santos', 'Athletico -PR', 'Bragantino', 'Ceara SC', 'Corinthians', 'Atletico-GO', 'Bahia', 'Sport Recife', 'Fortaleza', 'Vasco da Gama', 'Goiás', 'Coritiba', 'Botafogo') print...
class OutcomeInfo: '''Details for individual outcomes of a Market.''' def __init__(self, id, volume, price, description): self._id = id self._volume = volume self._price = price self._description = description @property def id(self): '''Market Outcome ID Returns int ''' return...
''' @author: Jakob Prange (jakpra) @copyright: Copyright 2020, Jakob Prange @license: Apache 2.0 ''' LETTERS = '_YZWVUTS' def index_category(category, nargs, result_index=0, arg_index=1, self_index=0): attr_str = ''.join((f'[{a}]' for a in category.attr - {'conj'})) + ('[conj]' if 'conj' in category.attr else...
# One Gold Star # Question 1-star: Stirling and Bell Numbers # The number of ways of splitting n items in k non-empty sets is called # the Stirling number, S(n,k), of the second kind. For example, the group # of people Dave, Sarah, Peter and Andy could be split into two groups in # the following ways. # 1. Dave, Sa...
def cpu_bound(n): return sum(i * i for i in range(n)) if __name__ == "__main__": n = int(input()) res = cpu_bound(n) print(res)
# Implement a queue using two stacks. Recall that a queue is a FIFO # (first-in, first-out) data structure with the following methods: enqueue, # which inserts an element into the queue, and dequeue, which removes it. class Queue: def __init__(self): self.ins = [] self.out = [] de...