content
stringlengths
7
1.05M
class Database: def __init__(self): self.stuff = {} def cleanup(self): self.stuff = {} def save(self, id, timestamp, count): self.stuff[id] = { 'timestamp': timestamp, 'count': count } def find_all(self, id): return [self.stuff[id]] ...
def assemble_message(message: str, error: bool = False) -> str: print("Assembling Message") if error: message = "-ERR {0}".format(message) else: message = "+OK {0}".format(message) return message
def longest_special_subseq(_n, dist, chars): chars = tuple(ord(char) - ord("a") for char in chars) print(chars) lengths = [0] * 26 # print(lengths) for char in chars: c_from = max(char - dist, 0) c_to = min(char + dist, 25) longest = max(lengths[c_from: c_to+1]) print...
class Solution: def climbStairs(self, n): """ :type n: int :rtype: int """ dp1 = 1 dp2 = 2 dp_step = 0 if n <= 1: return dp1 if n == 2: return dp2 while n > 2: dp_step = dp1 + dp2 dp1 = dp...
numero = int(input('Digite um numero para ver sua tabuada: ')) print('---------------') print('{} x 1 = {}'.format(numero, numero * 1)) print('{} x 2 = {}'.format(numero, numero * 2)) print('{} x 3 = {}'.format(numero, numero * 3)) print('{} x 4 = {}'.format(numero, numero * 4)) print('{} x 5 = {}'.format(numero,...
# Função para criar um cabeçalho def cab(msg): """ -> Cria um cabeçalho! :param msg: texto que será impresso na tela :return: nothing RRS """ tam = len(msg) + 4 line() print(f'{msg:^55}') line() # Cria uma linha de traços def line(): print(f'{"":-^50}')
''' We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return True if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done without any loops. ''' def make_bricks(sma...
def validacao_de_nota(): notas_validas = soma = 0 while True: if notas_validas == 2: break nota = float(input()) if 0 <= nota <= 10: soma += nota notas_validas += 1 else: print('nota invalida') media = soma / 2 print(f'media...
# -*- coding: utf-8 -*- def main(names): def get_format(is_angy): return "{0}.My name is {1}" if is_angy else "{0}.{1} is my classmate" for i, n in enumerate(names): print(get_format(n == "Angy").format(i, n)) if __name__ == "__main__": names = ("Bill", "Anne", "Angy", "Cony", "Daniel", ...
# # 6. write a function that takes an integer n and prints a square of n*n # def quadrat(n): sq=n*n print(sq) return sq quadrat(10)
'''test for having the file checked . if we request the channels from the file and there are no channels and when you call the channels from file .. you specify which file to call from .(which list) if the stream is already there then you dont want it to add the stream and notify the user that it already exists....
"""Errors used in pydexcom.""" class DexcomError(Exception): """Base class for all Dexcom errors.""" pass class AccountError(DexcomError): """Errors involving Dexcom Share API credentials.""" pass class SessionError(DexcomError): """Errors involving Dexcom Share API session.""" pass c...
with open("day2.txt", "rt") as file: data = file.readlines() valid = 0 valid2 = 0 for entry in data: parts = entry.split(' ') limits = parts[0].split('-') letter = parts[1].split(':')[0] password = parts[2] count = 0 for ch in password: if ch ...
# SPDX-License-Identifier: BSD-2-Clause """osdk-manager exceptions. Manage osdk and opm binary installation, and help to scaffold, release, and version Operator SDK-based Kubernetes operators. This file contains the custom exceptions utilized for the osdk_manager. """ class ContainerRuntimeException(Exception): ...
TRAINING_FILE_ORIG = '../input/adult.csv' TRAINING_FILE = '../input/adult_folds.csv'
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Presubmit script for devil. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for details on the presubmit API built into depot_...
# -*- coding: utf-8 -*- """Top-level package for filter_classified_reads.""" __author__ = """Peter Kruczkiewicz""" __email__ = 'peter.kruczkiewicz@gmail.com' __version__ = '0.2.1'
"""Styles for the frontend.""" async def style(): """Return styles.""" return """ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="...
open_brackets = ["[","{","("] close_brackets = ["]","}",")"] def validate_brackets(string): stack = [] for i in string: if i in open_brackets: stack.append(i) elif i in close_brackets: pos = close_brackets.index(i) if ((len(stack) > 0) and (ope...
def my_name(name): # import ipdb;ipdb.set_trace() return f"My name is: {name}" if __name__ == "__main__": my_name("bob")
''' Created on 25 apr 2019 @author: Matteo ''' CD_RETURN_IMMEDIATELY = 1 CD_ADD_AND_CONTINUE_WAITING = 2 CD_CONTINUE_WAITING = 0 CD_ABORT_AND_RETRY = 3
''' Escreva a função fizzbuzz que recebe como parâmetro um número inteiro e devolve 'Fizz' se o número for divisível por 3 e não for divisível por 5; 'Buzz' se o número for divisível por 5 e não for divisível por 3; 'FizzBuzz' se o número for divisível por 3 e por 5; Caso o número não seja divisível 3 e também não ...
n = 0 while True: n = int(input('Digite um número, para ver sua tabuada: ')) print('=' * 40) if n < 0: print('Esse programa foi interompido por prblemas tecmicos!') print('Por favor, tente novamente mais tarde!') break for c in range(1, 11): print(f'{n} x {c} = {n * c}') ...
load("@fbcode_macros//build_defs/lib:cpp_common.bzl", "cpp_common") load("@fbcode_macros//build_defs/lib:src_and_dep_helpers.bzl", "src_and_dep_helpers") load("@fbcode_macros//build_defs/lib:string_macros.bzl", "string_macros") load("@fbcode_macros//build_defs/lib:target_utils.bzl", "target_utils") load("@fbcode_macros...
## # File: PdbxChemCompConstants.py # Date: 21-Feb-2012 John Westbrook # # Update: # 21-Feb-2012 jdw add to chemcomputil repository # 1-Feb-2017 jdw unified with chem_ref_data # ## """ A collection of chemical data and information. """ __docformat__ = "restructuredtext en" __author__ = "John Westbrook" __email__ =...
class AverageMeter(object): """Stores the summation and counts the number to compute the average value. """ def __init__(self): self._sum = 0 self._count = 0 @property def avg(self): return self._sum / self._count if self._count != 0 else 0 @property def count(self)...
r''' .. _snippets-cli-tagging: Command Line Interface: Tagging =============================== This is the tested source code for the snippets used in :ref:`cli-tagging`. The config file we're using in this example can be downloaded :download:`here <../../examples/snippets/resources/datafs_mongo.yml>`. Example 1 ----...
class Funcionario: def __init__(self, nome, salario): self.nome=nome self.salario=float(salario) def aum_salario(self, pct): self.salario += (self.salario*pct/100) def get_salario(self): return self.salario
class Node(object): def __init__(self, val=None, children=None): self.val = val self.children = children
num = int(input('digite um numero:')) if num / 1 and num/ num: print('esse numero primo') else: print('esse numerp nap e primo')
''' https://www.hackerrank.com/challenges/python-loops/problem Task ==== The provided code stub reads and integer, , from STDIN. For all non-negative integers , print . Example ======= The list of non-negative integers that are less than is . Print the square of each number on a sep...
# Time: O(m*n), m = len(word1), n = len(word2) # Space: O(m*n) class Solution: def minDistance(self, word1: str, word2: str) -> int: """ 3 options for each char if chars match don't need to do anything subprobem(i,j) = subproblem(i-1,j-1) else: subproblem(i,j) = 1 + ...
''' Created on 24.07.2019 @author: LK ''' # TODO: Inheritance of tmcl interface class Landungsbruecke(object): GP_VitalSignsErrorMask = 1 GP_DriversEnable = 2 GP_DebugMode = 3 GP_BoardAssignment = 4 GP_HWID = 5 GP_PinState = 6
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ spyder.plugins.variableexplorer =========== Variable Explorer plugin used to instrospect variables in the namespace. """
''' https://app.codility.com/demo/results/demoHZEZJ5-D8X/ This is a demo task. Write a function: def solution(A) that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. For example, given A = [1, 3, 6, 4, 1, 2], the function should return 5. Give...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # for循环,只能使用 x in ... names = ['AA', 'BB', 'CC'] for name in names: print("name:", name) # 循环5次 for index in [0, 1, 2, 3, 4]: print("index:", index) for index in range(5): print("range index:", index) n = 3 while n > 0: print("n:", n) n = n - 1 # b...
def strategy(history, memory): if history.shape[1] % 3 == 2: # CC return 0, None # D else: return 1, None # C
class PixivException(Exception): pass class DownloadException(PixivException): pass class APIException(PixivException): pass class LoginPasswordError(APIException): pass class LoginTokenError(APIException): pass
print(20*'=') print('10 TERMOS DE UMA PA') print(20*'=') prim = int(input('Primeiro termo: ')) razao = int(input('Razão: ')) decimo = prim + (10 - 1) * razao for p in range(prim, decimo + razao, razao): print(p,end = ' \032 ') print('ACABOU')
def createMessageForArduino(flags, device_id, datasize, data): # prepare data, datasize depends whether we are working on # strings or not and therefor calculate it again byteData, datasize = getBytesForData(data) message = b'\xff' message += bytes([flags]) message += bytes([int(device_id)])...
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
# -*- coding: utf-8 -*- class ChainingHash(object): """ Hash table implementation which resolves collisions by using chaining. Attributes: num_buckets: int, how large should the internal array be to store data. data: list, a storage for hash data. """ def __init__(self, num_buckets):...
def max_sublist_sum(arr): max_ending_here = 0 max_so_far = 0 for x in arr: max_ending_here = max_ending_here + x max_so_far = max(max_so_far, max_ending_here) return max_so_far """ Max Sublist Sum max-sublist-sum Efficient equivalent to max(sum(arr[i:j]) for 0 <= i <= j <= len(arr)...
# List is python's version of array, zero-based indexing months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] print(months[0]) print(months[2]) print(months[-1]) list_of_random_things = [1, 3.4, 'a string', True] # watch for indexing error...
# -*- coding: utf-8 -*- """ test_training_separation.py: separates test and training dataset @author: Theresa Möller """ def imageSplit( data, labelcol='Label_nr', imagedim=[455,423], testsize=0.3): """ Split test and traing dataset taking the testsize proportion from the ...
# 用户类 class User(object): # 为对象添加属性 def __init__(self, name, idCard, phone, card): self.name = name self.idCard = idCard self.phone = phone self.card = card
# --- Day 11: Seating System --- # Your plane lands with plenty of time to spare. The final leg of your journey is a ferry that goes directly to the tropical island where you can finally start your vacation. As you reach the waiting area to board the ferry, you realize you're so early, nobody else has even arrived yet!...
# WiFi credentials wifi_ssid = "YourSSID" wifi_password = "YourPassword" # Ubidots credentials ubidots_token = "YourToken"
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 28 20:38:28 2020 @author: Chetan Patil """ # server properties KAFKA_SERVERS='server1:9092,server2:9092,server3:9092' KAFKA_SERVERS_DEV='localhost:9092' # transaction message properties TRANSACTION_MESSAGE_MERCHANT_ID='merchant_id' TRANSACTION_MES...
number_one = int(input()) number_two = int(input()) number_three = int(input()) for one in range(2, number_one + 1, 2): for two in range(2, number_two + 1): for three in range(2, number_three + 1, 2): if two == 2 or two == 3 or two == 5 or two == 7: print(f"{one} {two} {three}")
cor = {'traço': '\033[35m', 'ex': '\033[4;31m', 'título': '\033[1;34m', 'val': '\033[1;33m', 'desc': '\033[1;32m', 'via': '\033[1;31m', 'reset': '\033[m'} print('{}-=-{}'.format(cor['traço'], cor['reset'])*18, '{} Exercício 031 {}'.format(cor['ex'], cor['reset']), '{}-=-{}'.format(cor['traço'], cor['reset...
""" This program shows how changing an outside variable from within a function makes another variable! In this program, print_something has its own variable called z. It can no longer access the outer variable called z. """ z = 6.5 def print_something(): z = "hi" print(z * 3) print_something()...
#! /usr/bin/python HOME_PATH = './' CACHE_PATH = '/var/cache/obmc/' FLASH_DOWNLOAD_PATH = "/tmp" GPIO_BASE = 320 SYSTEM_NAME = "Garrison" ## System states ## state can change to next state in 2 ways: ## - a process emits a GotoSystemState signal with state name to goto ## - objects specified in EXIT_STATE_DEPE...
''' http://pythontutor.ru/lessons/ifelse/problems/rook_move/ Шахматная ладья ходит по горизонтали или вертикали. Даны две различные клетки шахматной доски, определите, может ли ладья попасть с первой клетки на вторую одним ходом. Программа получает на вход четыре числа от 1 до 8 каждое, задающие номер столбца и номер с...
def moeda(v): """ -> Função para formatar o valor :param v: Valor :return: Valor formatado """ return f'R$ {v:.2f}'.replace('.', ',')
def fahrenheit_to_celsius(temp_f): """Convert temperature in Fahrenheit to Celsius """ temp_c = (temp_f-32)*(5.0/9.0) return temp_c
class Table(object): """docstring for Table""" def __init__(self, arg): self.arg = arg
num = int(input('Digite um número: ')) print(''''\033[1;31;15m Escolha a base de conversão \033[m [ 1 ] Binário [ 2 ] Octal [ 3 ] Hexadecimal''') a = int(input('Sua Opção é: ')) if a == 1: print('O número {} em Binário é {}'.format(num, bin(num)[2:])) elif a == 2: print('O número {} em Octal é {} '.format(num, ...
A,B,C,D = map(float,input().split()) A = (A*2+B*3+C*4+D*1)/10 print(f'Media: {A:.1f}') if A>=7.0: print("Aluno aprovado.") elif A<5.0: print("Aluno reprovado.") elif A>=5.0 and A<7.0: print("Aluno em exame.") N = float(input()) print(f'Nota do exame: {N:.1f}') N = (A+N)/2 if N>=5.0: ...
# this file contains the ascii art for our equipment # HELMET # # # SHIELD ARMOR WEAPON # # # OTHER ITEMS ...... equipment = {'sword':[ ' /\ ', ' || ', ' || ', ' || ', ...
''' Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remaining elements to the right. Note that elements beyond the length of the original array are not written. Do the above modifications to the input array in place, do not return anything from your function. Example 1:...
linha1 = input() linha2 = input() linha3 = input() if(linha1 == 'vertebrado'): if(linha2 == 'ave'): if(linha3 == 'carnivoro'): print('aguia') else: print('pomba') else: if(linha3 == 'onivoro'): print('homem') else: print('vaca') el...
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def isUnivalTree(self, root: TreeNode) -> bool: if root: self.k=root.val sel...
def most_cash_prep(one_slot_size, start_p, wor_p, gap, lot_enhance): """ :param one_slot_size: :param start_p: :param wor_p: :param gap: in percent, 0.05 means gap is 5% in strategy :param lot_enhance: in percent, 0.3 means 1.3 in strategy :return: """ grids = round(((start_p - wor_p...
''' Faça um Programa que peça um número correspondente a um determinado ano e em seguida informe se este ano é ou não bissexto. ''' ano = int(input("Digite o ano")) if (ano%4 == 0 and ano%100 != 0) or ano%400 == 0: print("Bissexto") else: print("Não Bissexto")
T = int(input()) for _ in range(T): M, H = map(int, input().split()) B = M//H**2 if B<=18: print(1) elif B in range(19, 25): print(2) elif B in range(25, 30): print(3) else: print(4)
''' URL: https://leetcode.com/problems/regular-expression-matching/description/ Time complexity: O(n*m) Space complexity: O(n*m) ''' class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ is_match = [[False for j in range(len(...
"""P6E2 VICTORIA PEÑAS Escribe un programa que te pida números y los guarde en una lista. Para terminar de introducir número, simplemente escribe “Salir”. El programa termina escribiendo la lista de números.""" num1=int(input("Escribe un número: ")) listanum=[] i=num1 while i!="salir": listanum.append(int(i)) #indi...
ls = open('logs.txt').readlines() for line in ls: g = line.strip() g = "/d/c186/FarnettoApps/" + g print("echo loading %s"%(g)) print("java -Dserverid=farnetto -cp $CP farnetto.log4jconverter.Loader file:/%s 2>&1 | grep ERROR"%(g))
#Your function definition goes here def valid_date(date_str): if len(date_str) == 8: for ch in date_str: if ch == "/": return False if ch.isalpha(): return False date_str.split(".") day = int(date_str[:2]) month = int(date_str[3...
#Created with the Terminal ASCII Paint app by Michele Morelli - https://github.com/MicheleMorelli def draw_house(): print(" "*64+"\n"+" "*64+"\n"+" "*5+"_"*33+" "*26+"\n"+" "*4+"|"+"/"*4+"|"+"#"*28+" "*26+"\n"+" "*4+"|"+"/"*4+"|"+"#"*28+" "*26+"\n"+" "*4+"|"+"/"*4+"|"+"#"*2+" "*2+"|"+"/"+"|"+"#"*2+" "*3+"|"+"/"+"|...
""" observer pattern in python """ class Subject: """ # Represents what is being 'observed' """ def __init__(self): self._observers = ( [] ) # This where references to all the observers are being kept # Note that this is a one-to-many relationship: there will be o...
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def set_width(self, width): self.width = width def set_height(self, height): self.height = height def get_area(self): return self.height * self.width def get_perim...
def details(): name = input("What is your name? ") age = input("What is your age? ") username = input("What is your Reddit username? ") with open("python_get_details_details.txt", "a+", encoding="utf-8") as file: file.write(name + " " + age + " " + username + "\n") print("Your name is ...
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## This is a sample controller ## - index is the default action of any application ## - user is required for authentication and authorization...
""" rapidapi.livescore ~~~~~~~~~~~~~~~~~~ RapidAPI LiveScore API modules. @author: z33k """
def solve(n): notebook = {} for _ in range(n): student, grade = input().split(' ') if student not in notebook: notebook[student] = [] notebook[student] += [float(grade)] for st, gr in notebook.items(): print(f"{st} ->", end=' ') [print(f"{x:.2f}",...
""" Whenever we pick two rows and two columns of a Monge array and consider the four elements at the intersections of the rows and the columns, the sum of the upper-left and lower-right elements is less or equal to the sum of the lower-left and upper-right elements. Finding the leftmost minimum element in each row i...
""" If the function can access the variables in the global scope. So why do we need arguments? Explain with example. """ def greet(name): return f'Hello, {name} Good morning!' name1 = "Raj Nath Patel" name2 = "Raj Kumar" return_value = greet(name1) # Call function with return value print(return_value) return_v...
# Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 Robert Ryszard Paciorek <rrp@opcode.eu.org> # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Soft...
class Element(): def __init__(self, identifier, name, symbol): self.identifier = identifier self.name = name self.symbol = symbol self.metabolites = [] def add_compound(self, compound): if compound not in self.metabolites: self.metabolites.append(compound) ...
#Name Cases. Personal_Name = "joey Tribionny" print("Person's name in lower case: " + Personal_Name.lower()) print("Person's name in upper case: " + Personal_Name.upper()) print("Person's name in title case: " + Personal_Name.title())
# 1) Function that takes a string as a paratmeter and returns true if str contains at least 3 g false otherwise. # def threeg(stri): # gsum = 0 # for letter in stri.upper(): # if letter == 'G': # gsum += 1 # while gsum < 3: # return False # print(threeg('ggg') def g_count(any_...
# import pytest class TestFormatHandler: def test_read(self): # synced assert True def test_write(self): # synced assert True def test_append(self): # synced assert True def test_read_help(self): # synced assert True def test_write_help(self): # synced ...
num = [] soma = 0 for i in range(11): num.append(int(input())) n = len(num) for i in num: soma = soma + i media = soma / n print(media)
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") def _pre_render_script_ops_impl(ctx): output_filename = "{}.yaml".format(ctx.attr.name) output_yaml = ctx.actions.declare_file(output_filename) outputs = [output_yaml] ctx.actions.run( in...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/1/3 10:13 AM # @Author : Insomnia # @Desc : 丑数 # @File : UglyNum.py # @Software: PyCharm class Solution: def uglyNum(self, num): if num == 0: return False for i in range(2, 6): while (num % i == 0): ...
# # # # # a = 215 # # # # a = int(input("Input a")) # # # a = 9000 # # # a = 3 # # # # if True: # after : is the code block, must be indented # print("True") # print("This always runs because if statement is True") # print("Still working in if block") # # # if block has ended # print("This runs no matter w...
def test1(): l = [] for i in range(1000): l = l + [i] def test2(): l = [] for i in range(1000): l.append(i) def test3(): l = [i for i in range(1000)] def test4(): l = list(range(1000))
print("Listing Primes") prime_list = [] i = 0 while i < 10000: if i % 1000 == 0: print("Processed %d primes" % i) i += 1 prime = True for n in range(i): if n != 0 and n!= 1 and n!= i: if i % n == 0: prime = False if prime == True: prime_list.append(i) for i in r...
class Verb(object): def __init__(self, verb, subject): self.verb = verb self.subject = subject self.value = "" def format(self, context): subject = self.subject(context).value if subject.player: self.value = self.verb else: self.value = th...
""" Module with functionalities for blocking based on a dictionary of records, where a blocking function must return a dictionary with block identifiers as keys and values being sets or lists of record identifiers in that block. """ # =======================================================================...
def is_valid(row, col, size): return 0 <= row < size and 0 <= col < size # returns True or False def explode(row, col, size, matrix_in): bomb = matrix[row][col] for r in range(row - 1, row + 2): for c in range(col - 1, col + 2): if is_valid(r, c, size) and matrix_in[r][c] > 0: ...
# -*- coding: utf-8 -*- """ Train models module. """ #from modules.models.pytorch.alex_net import AlexNet #__all__ = ['AlexNet']
test_cases = int(input()) for i in range(test_cases): text = input() new_text = '' for l in text: if l.isalpha(): new_text += chr(ord(l) + 3) else: new_text += l new_text = new_text[::-1] half = int((len(new_text) / 2)) first_part = new_text[0:half] ...
# Ported from python 3.7 contextlib.py class nullcontext(object): """Context manager that does no additional processing. Used as a stand-in for a normal context manager, when a particular block of code is only sometimes used with a normal context manager: cm = optional_cm if condition else nullcontext()...
nome = str(input('Digite o seu nome completo:')).strip() print ('Analisando seu nome seu nome é {}'.format(nome.upper())) print ('Seu nome em minuscula é {}'.format(nome.lower())) print ('Seu nome tem {} letras'.format(len(nome) - nome.count(' '))) print ('Seu primeiro nome tem {} letras'.format(nome.find(' ')))
name = "signalfx-azure-function-python" version = "1.0.1" user_agent = f"signalfx_azure_function/{version}"
idade = int(input('Qual a sua idade: ')) if idade < 18: print ('Não pode beber ainda') else: print ('Pode beber')
# Implement the singleton pattern with a twist. First, instead of storing one # instance, store two instances. And in every even call of getInstance(), return # the first instance and in every odd call of getInstance(), return the second # instance. class Singleton(type): _instance = [] odd = True ...