content
stringlengths
7
1.05M
# # PySNMP MIB module E7-Notifications-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/E7-Notifications-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:58:58 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (defau...
config = { "domain": "example.com", "ruleset": "autoses", "s3bucket": "autoses-incoming", "sidprefix": "sid-autoses", "awsaccountid": "<FILL ME>", "region": "us-east-1", "sqs": { "message_retention_period": 14 * 24 * 3600, "visibility_timeout": 60, }, "lambda": { ...
# Lab 01 - Exercise 01 # First Number print("Please insert a first number: ", end='') try: a = int(input()) except ValueError: print("That didn't seem a number!") quit() # Second Number print("Please now insert a second number: ", end='') try: b = int(input()) except ValueError: print("That didn't...
class Router(object): def db_for_read(self, model, **hints): if model._meta.model_name == 'articleotherdb': return 'other' return None def db_for_write(self, model, **hints): if model._meta.model_name == 'articleotherdb': return 'other' return None d...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Delivery Costs', 'version': '1.0', 'category': 'Inventory/Delivery', 'description': """ Allows you to add delivery methods in sale orders and picking. =========================================...
""" Usando nossas proprias funcoes """ def maximo( lista ): maximo = lista[0] for elemento in lista: if elemento > maximo: maximo = elemento return maximo def maximo_4_valores(a, b, c, d): if a > b and a > c and a > d: return a elif b > c and b > d: return b ...
data = [ { "Idioma": "The best of both worlds.", "Significato": "poter godere di due opportunità nello stesso momento.", "Esempio": "By working part-time and looking after her kids two days a week she managed to get the best of both worlds." }, { "Idioma": "Speak of the devil...
{ 'targets': [ { 'target_name': 'DTraceProviderBindings', 'conditions': [ ['OS=="mac" or OS=="solaris" or OS=="freebsd"', { 'sources': [ 'dtrace_provider.cc', 'dtrace_probe.cc', ], ...
""" Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. Follow up: Could you do it without any loop/recursion in O(1) runtime? """ ...
# coding:utf-8 ''' @Copyright:LintCode @Author: taoleetju @Problem: http://www.lintcode.com/problem/construct-binary-tree-from-preorder-and-inorder-traversal @Language: Python @Datetime: 16-02-18 17:13 ''' """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val s...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"GaborLayer": "00_core.ipynb", "GaborLayer.create_xy_grid": "00_core.ipynb", "GaborLayer.build": "00_core.ipynb", "GaborLayer.create_kernel": "00_core.ipynb", "GaborLayer.c...
def word_lengths( file_path: str ) -> set: return { len(token) for line in open(file_path) for token in line.split() } def main(): file_path = 'comprehensions/file.txt' result = word_lengths(file_path) print(result) if __name__ == '__main__': main()
# This file is executed on every boot (including wake-boot from deepsleep) # notify print('RUN: boot.py')
class EndnoteObject: supported_cff_versions = ['1.0.3', '1.1.0'] supported_endnote_props = ['author', 'year', 'keyword', 'doi', 'name', 'url'] def __init__(self, cff_object, initialize_empty=False): self.cff_object = cff_object self.author = None self.doi = None self.keywor...
class CoordinatesAreNotGiven(Exception): def __init__(self, lon=1, lat=1, alt=1) -> None: self.message = "" if not lon: self.message += "Lon can't be None\n" if not lat: self.message += "Lat can't be None\n" if not alt: self.message += "Alt can't ...
def minRemoveToMakeValid(s): # O(n) time and space # doesn't use stack s = list(s) open_count = 0 for ind, c in enumerate(s): if c == "(": open_count += 1 elif c == ")": if not open_count: # if open_count is 0 s[ind] = "" ...
# -*- coding: utf-8 -*- # # Copyright (C) 2021 Graz University of Technology. # # invenio-campusonline is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see LICENSE file for more # details. """This module is used to import/export from/to the CampusOnline System."""
def nonify(func): def newAnB(*args, **arg): res = func(*args, **arg) return None if not res else res return newAnB
# [Required] Hero's Succession (22300) echo = 20011005 successor = 1142158 mir = 1013000 sm.setSpeakerID(mir) sm.sendNext("Master, master, look at this. There's something wrong with one of my scales!") sm.setPlayerAsSpeaker() sm.sendSay("That's...?! \r\n\r\n" "Mir, one of your scales is showing the #bOnyx Dragon's ...
""" https://www.freecodecamp.org/learn/scientific-computing-with-python/python-for-everybody/iterations-more-patterns Which of these evaluates to False? 0 == 0.0 0 is 0.0 0 is not 0.0 0 = 0.0 """ print(0 == 0.0) print(0 is 0.0) print(0 is not 0.0)
""" * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * """ a=''.join([input()for _ in[0]*4]) print('YNEOS'[all([a[x],a[x+1],a[x+4],a[x+5]].count('.')==2 for x in[0,1,2,4,5,6,8,9,10])::2])
#from coustmer import formate_coustmer def formate_coustmer(first, last ,location): full_name = '%s' '%s' %(first,last) if location: return '%s (%s)' %(full_name,location) else: return full_name if __name__ == '__main__': print(formate_coustmer('Lilly ', 'jokowich',location = 'california')) ...
# dashboard_generator.py print("-----------------------") print("MONTH: March 2018") print("-----------------------") print("CRUNCHING THE DATA...") print("-----------------------") print("TOTAL MONTHLY SALES: $12,000.71") print("-----------------------") print("TOP SELLING PRODUCTS:") print(" 1) Button-Down Shirt...
class MulticastDelegate(object): def __init__(self): self.delegates = [] def __iadd__(self, delegate): self.add(delegate) return self def add(self, delegate): self.delegates.append(delegate) def __isub__(self, delegate): self.delegates.remove(delegate) ...
class Exceptions: class NetworkError(Exception): def __str__(self): return "Network Error" class FileSystemError(Exception): def __str__(self): return "File System Error"
#!/usr/bin/env python3 l = '' with open('input') as f: l = [int(x) for x in f.read().split(',')] s = sorted(l)[len(l)//2] d = 0 for i in l: d += abs(s - i) print(d)
class UserDomain: def is_active(self, user): return user.email_confirmed user_domain = UserDomain()
FILTERS = [] ENDP_COUNT = 0 class Filter(object): def __init__(self): self.urls = [] self.filter_all = False self.order = 0 def filter(self, request, response): pass def _continue(self, request, response): return {"request": request, "response": response}
""" Challenge #2 Write a function that takes an integer 'minutes' and converts it to seconds. Examples: - convert(5) -> 300 - convert(3) -> 180 - convert(2) -> 120 """ def convert(minutes): return minutes * 60 print(convert(5)) #300 print(convert(3)) #180
""" Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are respons...
class LaneFitter(): def __init__(self, camera): if camera is None: raise Exception("Lane fitter needs a camera to undistort and warp") self.camera = camera def getfit(self, img, prev_left_fit=None, prev_right_fit=None): undistorted = self.camera.undistort(img) binary...
#raspberry pi GPIO pin definitions #using physical pin #'s, not GPIO #'s class GpioPins: LEFT_MOTOR_FORWARD = 31 LEFT_MOTOR_BACKWARD = 33 RIGHT_MOTOR_FORWARD = 35 RIGHT_MOTOR_BACKWARD = 37 ULTRASONIC_SENSOR_TRIG = 7 ULTRASONIC_SENSOR_ECHO = 12 IR_SENSOR_LEFT = 24 IR_SENSOR_RIGHT = 26 ...
"""986. Interval List Intersections""" class Solution(object): def intervalIntersection(self, A, B): """ :type A: List[List[int]] :type B: List[List[int]] :rtype: List[List[int]] """ p1 = 0 p2 = 0 res = [] while p1 < len(A) and p2 < len(B): # ...
n=int(input()) ans=0 fac=1 for i in range(1,n+1): fac*=i ans+=fac print(ans)
# Copyright 2014-2018 The PySCF Developers. 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 appl...
des = 'Desafio-025 strings-004' print ('{}'.format(des)) #Crie um programa que leia o nome de uma pessoa e diga se ela tem "silva" no seu nome. nome = str(input('Digite um nome: ')).strip() print ('Seu nome tem Silva? {}'.format('silva' in nome.lower()))
""" Once upon a time, on a way through the old wild west,… … a man was given directions to go from one point to another. The directions were "NORTH", "SOUTH", "WEST", "EAST". Clearly "NORTH" and "SOUTH" are opposite, "WEST" and "EAST" too. Going to one direction and coming back the opposite direction is a needless effo...
def is_armstrong_number(number): number_string = str(number) digits = len(number_string) if digits == 1: return True else: armstrong = sum([int(digit) ** digits for digit in number_string]) return number == armstrong
class Error(Exception): """Base class for exceptions in this module.""" def __str__(self): return self.message class EmptyUrlFieldError(Error): def __init__(self): self.message = "URL field cannot be empty." class InvalidUrlError(Error): def __init__(self, url): self.message...
REPORT_CASE_INDEX="report_cases_czei39du507m9mmpqk3y01x72a3ux4p0" REPORT_CASE_MAPPING={'_meta': {'comment': '2013-11-05 dmyung', 'created': None}, 'date_detection': False, 'date_formats': ['yyyy-MM-dd', "yyyy-MM-dd'T'HH:mm:ssZZ", "yyyy-MM-dd'T'HH:mm:ss.SSSSSS", ...
class Result: pass class CombingResult(Result): def __init__(self, elapsed_time_preprocess: int, elapsed_time_algo: int, hash: int, size_a: int, size_b: int, name_a, name_b): self.hash = hash self.elapsed_time_algo = elapsed_time_algo self.elapsed_time_preprocess = ela...
# Defining constants # TODO: add all species and experiments # TODO mapping RNA_SEQ_LIST = ['files/Caenorhabditis_elegans_RNA-Seq_read_counts_TPM_FPKM_GSE16552.tsv'] AFF_LIST = ['files/Caenorhabditis_elegans_probesets_GSE19972_A-AFFY-60_gcRMA.tsv'] exp_dict = {} for file in RNA_SEQ_LIST: # Opening the library fil...
s= raw_input() if s=="yes" or s=="YES" or s=="Yes": print ("Yes") else: print ("No")
# automatically generated by the FlatBuffers compiler, do not modify # namespace: io class DriverType(object): UNDEFINED = 0 LIBHDFS = 1 LIBHDFS3 = 2
''' Created on 1.11.2016 @author: Samuli Rahkonen ''' def kbinterrupt_decorate(func): ''' Decorator. Adds KeyboardInterrupt handling to ControllerBase methods. ''' def func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except KeyboardInterrupt: ...
class BaseLayout(object): @classmethod def render(cls, items): raise NotImplementedError
# THIS FILE IS GENERATED FROM THEANO SETUP.PY short_version = '0.9.0beta1' version = '0.9.0beta1' git_revision = 'RELEASE' full_version = '0.9.0beta1.dev-%(git_revision)s' % { 'git_revision': git_revision} release = False if not release: version = full_version
""" Custom path converters for urls https://docs.djangoproject.com/en/dev/topics/http/urls/#registering-custom-path-converters """ # Match a hexcolor in the url. # Must start with a # and contain 6 hexidecimal characters (0-9 and A-F), # in either lower or upper case. class HexColorConverter: regex = '([A-Fa-f0-9...
print('====== DESAFIO 01 ======') nome = input('Qual é o seu nome? ') print('Olá {}! Prazer em te conhecer!'.format(nome)) print(30*'=', '\n{:-^30}\n'.format(nome), 30*'=')
#!/usr/bin/env python3 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 BUCKET_NAME_BKT = "aws-saas-s3" BUCKET_NAME_PFX = "aws-saas-s3-prefix" BUCKET_NAME_TAG = "aws-saas-s3-tag" BUCKET_NAME_AP = "aws-saas-s3-ap" BUCKET_NAME_NSDB = "aws-saas-s3-dbns"
''' The provided code stub reads and integer, n, from STDIN. For all non-negative integers i<n, print i^2. ''' if __name__ == '__main__': n = int(input()) for i in range(n): print(i**2)
# # PySNMP MIB module CISCO-SYSLOG-CAPABILITY (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYSLOG-CAPABILITY # Produced by pysmi-0.3.4 at Wed May 1 12:13:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 ...
# Curso em vídeo - Desafio 050 - FOR ''' Desenvolva um programa que leia seis números inteiros e mostre a soma apenas daqueles que forem pares. Se o valor digitado for ímpar desconsidere-o. ''' s = 0 for i in range(6): n = int(input('Prezado usuário, digite um número: ')) if (n % 2) == 0: ...
princ_amount = float(input(" Please Enter the Principal Amount : ")) rate_of_int = float(input(" Please Enter the Rate Of Interest : ")) time_period = float(input(" Please Enter Time period in Years : ")) simple_interest = (princ_amount * rate_of_int * time_period) / 100 print("\nSimple Interest for Principal Amo...
def correct(seq, rules): if len(seq) != 3: return False for ch, rule in zip(seq, rules): if ch not in rule: return False return seq[-1] not in seq[:-1] if __name__ == "__main__": for s in ("ГВБ", "БАГ", "АББ", "ВГБ"): if correct(s, ("АВГ", "АБВ", "БВГ")...
M = int(input()) a = {int(i) for i in input().split()} N = int(input()) b = {int(i) for i in input().split()} c = sorted(a.symmetric_difference(b)) [print(i) for i in c]
class Solution: def totalNQueens(self, n: int) -> int: path = [-1] * n used = [False] * n cnt = 0 def backtrack(k): ''' k is the current level, 0-idexed ''' nonlocal path, used, cnt if k == n: cnt +=...
# # PySNMP MIB module SIP-REGISTRAR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/SIP-REGISTRAR-MIB # Produced by pysmi-0.3.4 at Wed May 1 15:04:26 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
#Leia um numero inteiro e monte sua tabuada n1 = int(input('Digite um numero inteiro: ')) print('Tabuada do numero : '.format(n1)) print(' 1 x {} = {}'.format(n1, n1*1)) print(' 2 x {} = {}'.format(n1, n1*2)) print(' 3 x {} = {}'.format(n1, n1*3)) print(' 4 x {} = {}'.format(n1, n1*4)) print(' 5 x {} = {}'.format(n1, n...
def calc_eval(exp): if isinstance(exp, Pair): if exp.first == "and": return eval_and(exp.rest) else: return calc_apply(calc_eval(exp, first), list(exp.rest.map(calc_eval))) elif exp in OPERATORS: return OPERATORS[exp] else: return exp def eval_and(op...
class ErrorMsg: float #float64 X_One #float64 Height_Of_Cone #float64 Area_Of_View_Top #float64 Area_Of_View_Bottom #bool Stop_Now
class HDPath: """ A class representing an HD path. This class is the base class for both account specific HD paths (:class:`~ape_trezor.hdpath.HDPath`) as well as the derivation HD path class :class:`~ape_trezor.hdpath.HDBasePath`. """ def __init__(self, path: str): path = path.rstrip("...
# # PySNMP MIB module NTWS-RF-DETECT-TC (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTWS-RF-DETECT-TC # Produced by pysmi-0.3.4 at Wed May 1 14:25:43 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
if __name__ == "__main__": sum_ = 0 for i in range(101): sum_ += i print(f"For 迴圈 1~100 : = {sum_}") sum_ = 0 i = 1 while i <= 100: sum_ += i i += 1 print(f"While 迴圈 1~100 : = {sum_}") # Advanced solution - List comprehension print(f"List comprehensi...
# Exemplos de aplicações de geradores def numeros(): for v in range(100): yield v n = numeros() # for v in n: # print(v) # Ao invés do for eu poderia usar a função next print(next(n)) print(next(n)) print(next(n)) print(next(n)) print(next(n)) # Assim por diante...
# -*- coding: utf-8 -*- #import ultron.sentry.api as api #import ultron.sentry.Math as Math #import ultron.sentry.Analysis as Analysis #import ultron.sentry.Utilities as Utilities __all__ = ['__version__'] __version__ = "0.0.1"
expected_output ={ "lisp_id": { 0: { "instance_id": { 8188: { "eid_table": "Vlan 210", "entries": 1, "eid_prefix": { "0017.0100.0001/48": { "uptime": "01:13:15", ...
a = 100 b = 3 print(a % b) print(divmod(a, b))
def cuttlefish_application(env, start_response, urls_handlers): request_uri = env['PATH_INFO'] response = cuttlefish_aplication_url(request_uri, urls_handlers, env) start_response(response['http_code'], response['http_content']) return [response['response']] def url_not_found(request_uri): respons...
""" A collection of Python modules used by Open GEE during the build process. """ __all__ = ['c_compiler', 'environ', 'version']
# *************************** Desafio 093 ******************************** # # Cadastro de Jogador de Futebol # # Crie um programa que gerencie o aproveitamento de um jogador de futebol. # # O programa vai ler o nome do jogador e quantas partidas ele jogou. # # Depois vai...
#!usr/bin/env python #-*-coding:utf-8 -*- #Filename:Class_Inherit.py ########This chapter is the most beautiful that can be felt from all the based practice #Multi-inherit to classify #Main class Animal(object): pass #Big class class Mammal(Animal): pass class Bird(Animal): pass #Small class c...
#!/usr/bin/python3 # -*- coding: utf-8 -*- '''\ Nomad-RPi testing modules. since: 23-APR-2018 '''
#!/usr/bin/env python3 """ Deal with spatial location of the cube. The grid definition in gpiline, gpxline, gpx, and gpy defines an affine transform from inline, crossline to world X, Y. Older ZGY files might use several ways to specify the transform. Since an affine transform is used it is possible to define a coor...
ICONS = ['new_file', 'open_file', 'save', 'cut', 'copy', 'paste', 'undo', 'redo', 'find_text'] theme_color = { 'Default': '#000000.#FFFFFF', 'Greygarious': '#83406A.#D1D4D1', 'Aquamarine': '#5B8340.#D1E7E0', 'Bold Beige': '#4B4620.#FFF0E1', 'Cobalt Blue': '#ffff...
""" Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB """ class Solution: # @param A : integer # @return a strings def convertToTitle(self, n): s = '' ...
# -*- coding: utf-8 -*- """ Created on Wed Apr 21 16:40:10 2021 @author: leyuan reference: https://github.com/brynhayder/reinforcement_learning_an_introduction/tree/master/code/exercises/ex_5_10 """ ''' TO DO '''
""" 1: 打印乘法口诀 """ for i in range(1,10): for j in range(1,i+1): print("{} * {} = {}\t".format(i,j,i * j),end="") print()
# -*- coding: utf-8 -*- """ jinja.exceptions ~~~~~~~~~~~~~~~~ Jinja exceptions. :copyright: 2007 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ class TemplateError(RuntimeError): pass class SecurityException(TemplateError): """ Raise if the template designer tr...
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"convert_file_to_json": "00-documentation.ipynb", "encode_file_as_utf8": "00-documentation.ipynb", "convert_nb_to_md": "00-documentation.ipynb", "junix.exporter.convert_file_to_json...
"""Create an executable with runfiles. Runfiles are files that are needed at runtime (when the executable in run). This example also shows a use of `ctx.expand_location`. """ def _impl(ctx): # Expand the label in the command string to a runfiles-relative path. # The second arg is the list of labels that may b...
""" 1. Faça um Programa que peça dois números e imprima o maior deles. """ n1 = int(input("Informe um número: ")) n2 = int(input("Informe um número: ")) if n1 > n2: print(n1) elif n2 > n1: print(n2) else: print(n1)
OCTICON_LOCATION = """ <svg class="octicon octicon-location" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M11.536 3.464a5 5 0 010 7.072L8 14.07l-3.536-3.535a5 5 0 117.072-7.072v.001zm1.06 8.132a6.5 6.5 0 10-9.192 0l3.535 3.536a1.5 1.5 0 002.122 0l3.535-3.53...
# Holds the state of the program, such as the items stored in the inventory # The State class will only store data, and will not itself perform operations on data class State: def __init__(self, targetTier): # Information about the world self.itemDependencyGraph = {} # key: name of an ...
""" Print this Pyramid in python 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 5 6 7 8 9 8 7 6 5 """ n = 5 num = 1 gap = n - 1 for j in range(1, n + 1): num = j for i in range(1, gap - 1): print(" ", end="") gap = gap - 1 for i in range(1, j + 1): print(num, end="") num ...
frase1='Curso em Vídeo Python' frase2=' Aprenda Python ' print('Frase 1: Curso em Vídeo Python') print(frase1[1:9]) print(frase1[1::2]) print('') print(len(frase1)) print('') print(frase1.count('o')) print('') print(frase1.find('deo')) print('') print('Curso' in frase1) print('') print(frase1.upper()) print('') print...
''' Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only nodes itself may be changed. Only constant memory is allowed. For...
class Solution: def countRoutes(self, locations: List[int], start: int, finish: int, fuel: int) -> int: dp = [[-1] * 201 for _ in range(101)] MOD = 1000000007 def helper(pos, left): if left < 0: return 0 if dp[pos][left] != -1: return d...
#!/usr/bin/python3 """归并排序 注意处理列表不等长的情况 """ def mergeSort(alist): if len(alist) > 1: mid = len(alist) // 2 lefthalf = alist[:mid] righthalf = alist[mid:] mergeSort(lefthalf) mergeSort(righthalf) i, j, k = 0, 0, 0 while i < len(lefthalf) and j < len(righthal...
def make_averager(): ## Scope average implementation, with nonlocal to best performance. count = 0 total = 0 def averager(new_value): nonlocal count, total count += 1 total += new_value return total / count return averager
"""Exercício Python 50: Desenvolva um programa que leia seis números inteiros e mostre a soma apenas daqueles que forem pares. Se o valor digitado for ímpar, desconsidere-o.""" soma = 0 cont = 0 for c in range(1, 7): valor = int(input('Digite o {}° valor: '.format(c))) if valor % 2 == 0: soma = soma +...
"""Quicksort with Lomuto partitioning.""" def sort(lst, start=0, stop=None): """In-place quicksort. Args: lst: List to sort start: Start index stop: Stop index """ if stop is None: stop = len(lst) length = stop - start if length <= 1: return pivot...
class Solution: def isMatch(self, s, p): def compare(a, b): return a == '.' or a == b s = '=' + s + '=' p = '=' + p + '=' n = len(s) m = len(p) flag = [0] * n flag[0] = 1 cur = 1 while cur < m: target = p[cur] ...
#Desafio: Refaça o desafio 51, lendo o primeiro termo e a razão de uma PA, #mostrando o 10 primeiros termos da progressão aritmética usando a estrutura while. prim_termo = int(input('Digite o 1º termo: ')) razao = int(input('Qual a razão dessa PA? ')) cont = 1 res = prim_termo print('Os 10 primeiros termos dessa PA sã...
''' 01 - Bar chart Bar charts visualize data that is organized according to categories as a series of bars, where the height of each bar represents the values of the data in this category. For example, in this exercise, you will visualize the number of gold medals won by each country in the provided me...
print("There once was a man named John") print("he was 35 years old.") print("He really liked the name John, ") print("but didnt like being 35") """ Basically there are several types of variables in python. Booleans, Strings, Floats, etc. We can call any variables as the name we want to. Just by typping Variable...
# This problem was asked by Uber. # Implement a 2D iterator class. It will be initialized with an array of arrays, and should implement the following methods: # • next(): returns the next element in the array of arrays. If there are no more elements, raise an exception. # • has_next(): returns whether or not the iterat...
SPOTIFY_SCOPE = "user-read-playback-state user-modify-playback-state" SPOTIFY_CLIENT_ID = "123123adads" SPOTIFY_CLIENT_SECRET = "76756757jgjghgjh" # don't change or don't forget to update app.py as well SPOTIFY_REDIRECT_URI = "http://localhost:8080/callback"
words = input().split(" ") dictionary = {} for current_word in words: current_word = current_word.lower() if current_word not in dictionary: dictionary[current_word] = 0 dictionary[current_word] += 1 for key, value in dictionary.items(): if value % 2 != 0: print(key, end=" ")
class FunctionNotAllowed(Exception): ... class TelegramBaseException(Exception): ... class TelegramAPIException(TelegramBaseException): ... class TelegramDataObjectException(TelegramBaseException): ... class HandlerException(TelegramBaseException): ... class HandlerCloseException(TelegramB...