content
stringlengths
7
1.05M
#PAIS A 80000 3% DE TAXA DE CRESCIMENTO #PAIS B 200000HABITANTES TAXA DE CRESCIMENTO 1,5% a = int(input('Digite a população da cidade A: ')) b = int(input('Digite a população da cidade B: ')) cont = 0 if b > a: while b > a: a += a * 0.03 b += b * 0.015 cont += 1 print(f'A ultrapassa B em...
#Iniciando o navegador e acessando a página de login que se deseja testar click("1509147510293.png"); type("Google Chrome"); type(Key.ENTER); wait("1509147713937.png"); click("1509147762955.png"); paste("http://localhost/ChuvaInc/ChuWar/"); type(Key.ENTER); wait("1509148189422.png"); #Criando Menu de Seleção de Testes...
# -*- coding: utf-8 -*- # region CUT ROD def memoized_cut_rod(p, n): """ 钢条切个问题 动态规划实现 待备忘录的自顶向下法(top-down with memoization) :param p: :param n: :return: """ r = [float('-inf')] * n return _memoized_cut_rod_aux(p, n, r) def _memoized_cut_rod_aux(p, n, r): if r[n - 1] >= ...
X = 'spam' Y = 'eggs' # will swap X, Y = Y, X print((X, Y))
fout=open('oops.txt','wt') print('oops, i created a file',file=fout) fout.close() fin=open('oops.txt','rt') po=fin.read() fin.close() print(po)
# Curbrock Summon 3 CURBROCK3 = 9400931 # MOD ID CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID sm.spawnMob(CURBROCK3, 320, -208, False) sm.createClock(1800) sm.addEvent(sm.invokeAfterDelay(1800000, "warp", CURBROCKS_ESCAPE_ROUTE_VER3, 0)) sm.waitForMobDeath(CURBROCK3) sm.warp(CURBROCKS_ESCAPE_ROUTE_VER3) sm.stopEv...
#! /usr/bin/python class Calculator(object): def add(self, operanda, operandb): return operanda + operandb
#!/usr/bin/python3 def print_matrix_integer(matrix=[[]]): for X in matrix: for Y in X: print('{:d}'.format(Y), end="") if Y != X[-1]: print(' ', end="") print()
class Position: """ Coordanates system that uses an 'y' and 'x' notation to represent unequivocally a specific location that goes universally for every object. """ __slots__ = ('y', 'x') @staticmethod def create_collection(first_position: tuple, last_position: tuple): "...
#!/usr/bin/env python3 bday_dict = {} while True: name = input("\nEnter name: ") if len(name) != 0 and type(name) == str: # Check the existence of the name in bday_dict if bday_dict.get(name): print("\n{} found in db".format(name)) print("Name: {}".format(name)) ...
N=int(input()) A=list(map(int,input().split())) diff=0 ans=N for i in range(N-1): if A[i]<A[i+1]: diff+=1 ans+=diff else: diff=0 print(ans)
clientes = { 'cliente1': {'nome': 'Rafael', 'sobrenome': 'Inacio'}, 'cliente2': {'nome': 'Jacaré', 'sobrenome': 'Vacinado'} } for clientes_k, clientes_v in clientes.items(): print('Exibindo {}'.format(clientes_k)) for dados_k, dados_v in clientes_v.items(): pri...
""" An issue with binary trees is the insertion order can make the tree unbalanced, making the complexity O(n) for all operations We can solve this issue with a self-balancing tree: the two most common being: 1: AVL tree- faster for looking up values and may take less space than red-black trees (depending on the situa...
inFile = open('input.txt') primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] for line in inFile: n = int(line) if n == 0: break lenPrime = len(primes) counter = [0] * lenPrime for i in range(1, n + 1): number = i ...
structure = { 'Public_encryption': 'public Alice key for encoding', 'Public_signing': 'public Alice key for signing', 'Message': {'message_id_hash': #message_id_5383710b780583f1f462b6e719071523147cde25a5a47c380126c3395f84b9b3 {'Address': address, #e6jB08WPeBjoPS4Lb4CFRVW/TAWSrGq7MD5OG8NVA794z4GwhlXz7vov1i2w6GLWY...
# We are dealing with the "Young's Double Slit Experiment" simulation here: # https://github.com/NSLS-II/sirepo-bluesky/blob/master/sirepo_bluesky/tests/SIREPO_SRDB_ROOT/user/SdP3aU5G/srw/00000000/sirepo-data.json RE( optimization_plan( fly_plan=run_fly_sim, bounds=param_bounds, db=db, ...
""" This module includes wrapper classes for Tool connection parameters """ #pylint: disable=too-few-public-methods class ToolConnection(object): """ Base class for ToolConnection classes used to wrap configuration parameters for tool connections """ #pylint: disable=too-few-public-methods class ToolUsbHi...
'''class Pessoa(object): def __init__(self, nome, idade, peso): self.nome = nome self.idade = idade self.peso = peso def andar(self): print('anda') pessoa1 = Pessoa("Juliana", 23, 75) pessoa2 = Pessoa("Carlos", 39, 72) print(pessoa1.nome) pessoa1.andar() def fatorial(n): i...
""" Implements a set of ORMs for getting, setting against a database """ class RawJobDescriptionClient(object): raise NotImplementedError
{ "targets": [ { "target_name": "addon", "sources": ["./src/cpp/nodeBridge.cpp", "./src/cpp/os/windows.cpp"], "include_dirs": [ "<!@(node -p \"require('node-addon-api').include\")" ], 'defines': [ 'NAPI_CPP_EXCEPTIONS' ] } ...
#1.根据以下描述,尝试用程序呈现 # 属性:长和宽 # 方法:1)设置长和宽 2)获取长和宽 3)获取面积 class Cfx(object): def __init__(self,length1,width1): self.__length1 = length1 self.__width1 = width1 def pri_cfx(self): print("长方形的长和宽分别为{},{}".format(self.__length1,self.__width1)) def setlength1(self,newlength1): self.__length1 = newlength1 def...
expected_output = {'interface': {'Eth5/48.106': {'interface_status': 'protocol-down/link-down/admin-up', 'ip_address': '10.81.6.1'}, 'Lo3': {'interface_status': ...
# Desafio 085 -> C. um programa onde o usuário possa digitar 7 valores numericos e cadastre-os em uma lista única # que mantenha separados os valores pares e impares (duas listas, uma pra par e outra pra impar). # No final, mostre os valores pares e impares em ordem crescente lista =...
#!/usr/bin/env python3 grid = {} def sum_neighboors(x, y): sum = 0 for i in range(-1, 2): for k in range(-1, 2): sum = sum + grid.get((x + i, y + k), 0) return sum def print_grid(grid): print("---") for i in range(-10, 10): for k in range(-10, 10): print(...
#!/usr/bin/env python3 ipchk = "192.168.0.1" # a string tests as True if ipchk: print("Looks like the IP address was set: " + ipchk)
class BloxplorerException(Exception): def __init__(self, message, resource_url, request_method): self.message = message self.resource_url = resource_url self.request_method = request_method def __str__(self): return f'{self.message} (URL: {self.resource_url}, Method: {self.requ...
__author__ = 'Managed by Q, Inc.', __author_email__ = 'open-source@managedbyq.com' __description__ = 'MBQ Atomiq' __license__ = 'Apache 2.0' __title__ = 'mbq.atomiq' __url__ = 'https://github.com/managedbyq/mbq.atomiq' __version__ = '1.1.0'
# -*- coding: utf-8 -*- __author__ = "Thomas Bianchi" __copyright__ = "Thomas Bianchi" __license__ = "mit"
num1=int(input("enter a num")) num2=int(input("enter a num")) if num1<0 and num2<0: print("enter a positive number") else: sum=0 while(num1>0 and num2>0): sum = num1+num2 print("the sum is",sum) break
def counting_sort(A, B, k): C = [0 for i in range(0, k+1)] for j in A: C[j] += 1 for i in range(1, k+1): C[i] += C[i-1] for n in reversed(A): B[C[n]-1] = n C[n] = C[n] - 1 return B if __name__ == "__main__": myList = [4,0,3,6,1,5,7,0,4] otherList = [0 for i in range(0, len(myList))] pri...
class APP: APPLICATION = "denon-commander" AUTHOR = "Aleksander Psuj" VERSION = "V1.0" class CONNECTION: # I recommend to set static IP address on device IP = "192.168.1.150" class DEFAULT: # Default volume from -80 to 18 VOLUME = "-40" # Default input INPUT = "GAME" ...
#ex042: Refaça o DESAFIO 35 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado: #– EQUILÁTERO: todos os lados iguais #– ISÓSCELES: dois lados iguais, um diferente #– ESCALENO: todos os lados diferentes r1 = float(input('Primeiro segmento: ')) r2 = float(input('Segundo segmento: ')) r...
def longestSubsequence(A, N): L = [1]*N hm = {} for i in range(1,N): if abs(A[i]-A[i-1]) == 1: L[i] = 1 + L[i-1] elif hm.get(A[i]+1,0) or hm.get(A[i]-1,0): L[i] = 1+max(hm.get(A[i]+1,0), hm.get(A[i]-1,0)) hm[A[i]] = L[i] return max(L) A = [1, 2, 3, 4, 5, 3, 2] N = len(A) print(longestSubsequence(A, N))
#reversing a string using loop s = ('Python is the best programming language') reversed_string = '' for i in range(len(s)-1, -1, -1): reversed_string += s[i] print("reversed string: ", reversed_string) exit() #The range() function has two sets of parameters, as follows: #range(stop) #stop: Number of integer...
# math3d_side.py class Side: NEITHER = 'NEITHER' BACK = 'BACK' FRONT = 'FRONT'
#!/usr/bin/python # encoding: utf-8 """ @author: Ian @contact:yongguiluo@hotmail.com @file: text.py.py @time: 2019/3/20 14:02 """ title = '智能金融起锚:文因、数库、通联瞄准的kensho革命' text = '''2015年9月13日,39岁的鲍捷乘上从硅谷至北京的飞机,开启了他心中的金融梦想。 鲍捷,人工智能博士后,如今他是文因互联公司创始人兼CEO。和鲍捷一样,越来越多的硅谷以及华尔街的金融和科技人才已经踏上了归国创业征程。 在硅谷和华尔街,已涌现出Alphasense、Kensho...
"""Defines the StartResponseMock class. Copyright 2013 by Rackspace Hosting, Inc. 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 ...
first_space = int(input()) end_space = int(input()) magic_num = int(input()) combinations = 0 is_found = False for a in range(first_space, end_space + 1): for b in range(first_space, end_space + 1): combinations +=1 if a + b == magic_num: print(f'Combination N:{combinations} ({a} + {b} =...
#!/bin/python PrimerTypes = ["ForwardPrimer", "ReversePrimer"] FastaRegionPrefix = "REGION_" ClustalCommand = "clustalo"
# DICTIONARY cod_uf = { 21 : 'Maranhão', 22 : 'Piauí', 23 : 'Ceará', 24 : 'Rio grande Do Norte', 25 : 'Paraíba', 26 : 'Pernanbuco', 27 : 'Alagoas', 28 : 'Sergipe', 29 : 'Bahia'} print(type(cod_uf)) print(cod_uf) print('\n/******************************/\n') # Valores Ordenados. ...
# Read two integer numbers and, after that, exchange their values. Print the variable values before and after the exchange, as shown below: a = int(input()) b = int(input()) print(f'Before:\na = {a}\nb = {b}') a, b = b, a print(f'After:\na = {a}\nb = {b}')
IDENTITY = lambda a: a IF = IDENTITY # boolean values TRUE = lambda a: lambda b: a FALSE = lambda a: lambda b: b # base boolean operations OR = lambda a: lambda b: a(TRUE)(b) AND = lambda a: lambda b: a(b)(FALSE) NOT = lambda a: a(FALSE)(TRUE) # additional boolean operations XOR = lambda a: lambda b: a(b(FALSE)(T...
def merge(d, *dicts): """ Recursively merges dictionaries """ for d_update in dicts: if not isinstance(d, dict): raise TypeError("{0} is not a dict".format(d)) dict_merge_pair(d, d_update) return d def dict_merge_pair(d1, d2): """ Recursively merges values f...
# example to understand variables a = [2, 4, 6] b = a a.append(8) print(b) # example to understand variables scope a = 15; b = 25 def my_function(): global a a = 11; b = 21 my_function() print(a) #11 print(b) #25
def multiply(a,b): return a*b def divide(a,b): return a/b
expected_output = { "version": { "build_time": "08:13:43 Apr 7, 2021", "firmware_ver": "18r.1.00h", "install_time": "07:14:32 Jun 1, 2021", "slot": { "L1/0": { "name": "L1/0", "primary_ver": "18r.1.00h", "secondary_ver": "...
# coding:utf-8 # example 20: priority_queue.py class Array(object): def __init__(self, size=32): self._size = size self._items = [None] * size def __getitem__(self, idx): return self._items[idx] def __setitem__(self, idx, val): self._items[idx] = val def __len__(self...
# testNamespace.someFunction testNamespace.some_function("", 0, False) # testNamespace.someFunctionWithDefl testNamespace.some_function_with_defl(5, True)
def solve(): n = int(input()) f = [1, 2] + [0] * (n - 2) for i in range(2, n): f[i] = (f[i - 2] + f[i - 1]) % 15746 print(f[n - 1]) solve()
# Faça uma solução lógica em Python para resolver a o problema do Pedro, que comprou um saco de ração com peso em quilos. Ele possui três gatos, para os quais fornece a quantidade de ração em gramas. A quantidade diária de ração fornecida para cada gato é sempre a mesma. Faça uma lógica que receba o peso do saco de raç...
# -*- coding: UTF-8 -*- """Set Operations.""" hero1 = {"smart", "rich", "armored", "martial_artist", "strong"} hero2 = {"smart", "fast", "strong", "invulnerable", "antigravity"} type(hero1) type(hero2) # Attributes for both heros (union) hero1 | hero2 hero1.union(hero2) # Attributes common to both heros (intersecti...
m, n = map(int, input().split()) dicionario = {} for i in range(m): cargo, valor = input().split() dicionario[cargo] = int(valor) for i in range(n): a = input().split() total = 0 while a != ["."]: for word in a: if word in dicionario: total += dicionario[word] a = input().split() print(total)
f = lambda seg,c: sum([v[0]/(v[1]+c) for v in seg]) n,t = [int(i) for i in input().split()] seg = [] l,r = -2011,10**9 for i in range(n): seg.append([int(j) for j in input().split()]) l = max(l,-seg[i][1]) c = (l+r)/2 curr = f(seg,c) it = 1000 while abs(curr-t) > 10**(-7) and it > 0: if curr >= t: ...
def particionar(lista, inicio, fim): """ Com base em um elemento pivo, coloca a esquerda dele todos os elementos menores que ele e a direita todos os elementos maiores que ele. Retornando a real posição desse pivo """ pivo = lista[inicio] i = inicio j = fim ter...
# Copyright (c) 2020 Graphcore Ltd. All rights reserved # signatures for manually added operators signatures = { 'beginIpuBlock': [['clong'], ['clong'], ['clong']], 'cast': ['Args', ['scalar_type']], 'internalCast': ['Args', ['cstr']], 'constantPad': ['Args', ['clong_list'], ['cfloat']], 'edgePad':...
def post(settings): data = {"dynaconf_merge": True} if settings.get("ADD_BEATLES") is True: data["BANDS"] = ["Beatles"] return data
# Bluerred Image Detection # # Author: Jasonsey # Email: 2627866800@qq.com # # ============================================================================= """global config file""" # ------------------------------net config------------------------ NUM_CLASS = 2 # number of classes CUDA_VISIBLE_DEVI...
#Задачи на циклы и оператор условия------ #---------------------------------------- ''' Задача 1 Вывести на экран циклом пять строк из нулей длиной 4, причем каждая строка должна быть пронумерована. Пример: 0 0000 1 0000 2 0000 3 0000 .... ''' ''' Задача 2 Пользователь в цикле вводит 10 производных...
class Text(): RED = "\033[1;31;1m" GREEN = '\033[1;32;1m' YELLOW = '\033[1;33;1m' UNDERLINE = '\033[4m' def apply(str, format): return(format + str + '\033[0m')
qntpao=12 qntcookies=20 precopao=6.79 precookies=11.34 valor=0 quantidade=0 tipocomida=str(input('digite o tipo de comida :')).upper() qntpessoas=int(input('digite a quantidade de pessoas que vão à festa:')) if tipocomida=='COOKIE': quantidade=int(qntpessoas/qntcookies) print('a quantidade de pacotes é {} e o...
# ................................................................................................................. level_dict["bronze"] = { "scheme": "bronze_scheme", "size": (9,6,9), "intro": "bronze", "hel...
# parsetab.py # This file is automatically generated. Do not edit. _tabversion = '3.10' _lr_method = 'LALR' _lr_signature = 'leftIDleftNUMBERINFINITYleftBEGIN_CASEEND_CASEBEGIN_BMATRIXEND_BMATRIXBEGIN_PMATRIXEND_PMATRIXBACKSLASHESleftINTEGRALDIFFERENTIALDIEPARTIALLIMITTOrightCOMMArightPIPErightLPARENRPARENrightLBRAC...
class EndPointParam: NO_VALUE = (None, ) # Simple tuple for testing with `is` def __init__(self, vtype=str, default=NO_VALUE, help_text=None, required=False): self.name = 'param' self.data_type = vtype self.default = default self.help_text = help_text self.required = ...
async def test_index(test_cli): resp = await test_cli.get('/') assert resp.status == 200 data = await resp.text() assert '<title>squash</title>' in data
if name: env = 1 else: env = 2
n,k = map(int,input().split()) s = input() if n//2 >= k: for i in range(k-1): print("LEFT") for i in range(n-1): print("PRINT",s[i]) print("RIGHT") print("PRINT",s[n-1]) else: for i in range(n-k): print("RIGHT") for i in range(1,n): print("PRINT",s[-i]) ...
def stringsRearrangement(inputArray): ''' Given an array of equal-length strings, check if it is possible to rearrange the strings in such a way that after the rearrangement the strings at consecutive positions would differ by exactly one character. ''' totalLen = len(inputArray) for i in ...
print('\033[33m-=' * 13) print('Analisador de Triângulos') print('-=' * 13 + '\033[m') primeiroSegmento = float(input('Primeiro segmento: ')) segundoSegmento = float(input('Segundo segmento: ')) terceiroSegmento = float(input('Terceiro segmento: ')) lados = [primeiroSegmento, segundoSegmento, terceiroSegmento] lados....
# https://projecteuler.net/problem=20 def reverse_str(s): return s[::-1] def sum_str(a, b): if len(b) > len(a): return sum_str(b, a) reverseA = reverse_str(a) reverseB = reverse_str(b) i = 0 add = 0 result = [] while i < len(a): o1 = int(reverseA[i]) o2 = 0 ...
''' lec 3 ''' my_list = [1,2,3,4,5] print(my_list) my_nested_list = [1,2,3,my_list] print(my_nested_list) my_list [0] = 6 print(my_list) print(my_list[0]) print(my_list[1]) print(my_list[-1]) print(my_list) print(my_list[1:3]) print(my_list[:]) x,y = ['a', 'b'] print(x,y) print(my_list) my_list.append(7) print...
class dummy_storage: def retrieve(self): return {} def persist(self, credentials): return None
# https://app.codesignal.com/interview-practice/task/5vcioHMkhGqkaQQYt/solutions # Singly-linked lists are already defined with this interface: # class ListNode(object): # def __init__(self, x): # self.value = x # self.next = None # def rearrangeLastN(head, n): if n < 1: return head l = 0...
x = int(input()) ans = 0 ans = (x//500)*1000 x = x % 500 ans += (x//5)*5 print(ans)
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def dfs(self, root): stack = [] stack.append((root, 1)) ans = sys.maxsize while stack: ...
class SubScript(): """Creates an instance of SubScript""" def __init__(self): self.NUM_0 = u'\u2080' self.NUM_1 = u'\u2081' self.NUM_2 = u'\u2082' self.NUM_3 = u'\u2083' self.NUM_4 = u'\u2084' self.NUM_5 = u'\u2085' self.NUM_6 = u'\u2086' ...
student = { "name": "Mark", "student_id": 15163, "feedback": None } all_students = [ {"name": "Mark", "student_id": 15163}, {"name": "Katarina", "student_id": 63112}, {"name": "Jessica", "student_id": 30021} ] student["name"] == "Mark" student["last_name"] == KeyError student.get("last_name", ...
og=list(input("Enter number ")) new=set(og) print("".join(og),"is a Unique Number") if len(new)==len(og) else print("".join(og),"is not a Unique Number")
n = int(input()) cont = 0 while cont < n: num = int(input()) if cont == 0: maior = num elif num > maior: maior = num cont += 1 print(maior)
class Solution: def climbStairs(self, n: int) -> int: if n==1: return 1 if n==2: return 2 l=[1,2] for i in range(2,n): l.append(l[i-1]+l[i-2]) return l.pop()
class PipelineException(Exception): def __init__(self, msg=''): self.msg = msg super(PipelineException, self).__init__(msg)
b=[9,6,3,2,5,8,7,4,1,0] def selection_sort(b): for i in range((len(b))-1): min = b[i] for j in range(i + 1, len(b)): if b[j] < min: min = b[j] pos=j b[pos] = b[i] b[i]=min print(b) selection_sort(b) pri...
""" Python escritura en disco Puede leer y escribir archivo con la funcion (open) Los archivos pueden ser de texto o binarios Manejadores : * r = read * w = write * a = append * r+ = lee y escribe Se deben cerrar los archivos con el método (close) """ archivo = '/Users/javier/fi...
def cipher(s): return ''.join((map(lambda c: chr(219-ord(c)) if 97 <= ord(c) <= 122 else c, s))) print(cipher('Anyone who has never made a mistake has never tried anything new.'))
#conversor de moedas reais = float(input('Digite o valor em reais: R$ ')) print('R$ {:.2f} equivalem a US$ {:.2f} dolares. Triste :<'.format(reais, (reais/5.74))) print ('R$ {:.2f} equivalem a € {:.2f} euros. hahaha só piora\n'.format(reais, (reais/6.71)))
"""Task queue - deque example""" class TaskQueue: """Task queue using list""" def __init__(self): self._tasks = [] def push(self, task): self._tasks.insert(0, task) def pop(self): return self._tasks.pop() def __len__(self): return len(self._tasks) def test_queue...
# BOJ 9465 n = 5 stickers = [[50, 10, 100, 20, 40], [30, 50, 70, 10, 60]] memo = [[0 for _ in range(n)] for _ in range(2)] memo[0][0] = stickers[0][0] memo[0][1] = stickers[0][1] def solve(n): for i in range(1, n): if i < 2: memo[0][i] = memo[1][i - 1] + stickers[0][i] memo[1][i] ...
class GenericMachine(): alphabet = set() trans_func = dict() start_state = str() final_states = set() def __init__(self, _alphabet, _trans_func, _start_state, _final_states): self.alphabet = _alphabet self.trans_func = _trans_func self.start_state = _start_state self...
''' Python has built-in string validation methods for basic data. It can check if a string is composed of alphabetical characters, alphanumeric characters, digits, etc. str.isalnum() This method checks if all the characters of a string are alphanumeric (a-z, A-Z and 0-9). >>> print 'ab123'.isalnum() True >>> print 'a...
""" This is the page definition file for Famcy. There are two variables very important, which defines the page content: PAGE_HEADER and PAGE_CONTENT. PAGE_HEADER: * title: a list of titles of the sections on the page. It is usually put at the top of the section as a header. * size: a list. defines section size....
# -*- encoding: utf-8 -*- class WebError(Exception): def __init__(self, code, message=''): Exception.__init__(self) self.code = code self.message = message def __str__(self): return self.message
HELP_MESSAGE = """Hi there, I am a bot that shows the current free games on all the major game platforms out there. You will get automatically notified when new games become free to collect. If you would like to see the current free game please use the following command: /freegame """ BOT_TOKEN = '123'
# EG7-09 get_value investigation 2 def get_value(prompt, value_min, value_max): return ride_number=get_value(prompt='Please enter the ride number you want:',value_min=1,value_max=5) print('You have selected ride:',ride_number)
# https://www.codewars.com/kata/5266876b8f4bf2da9b000362/train/python def likes(names): counter=0 for name in names: counter+=1 if counter==0: return("no one likes this") elif counter==1: return(f"{names[0]} likes this") elif counter==2: return(f"{names[0]} and {n...
# Created by MechAviv # Quest ID :: 20865 # The Path of a Thunder Breaker sm.setSpeakerID(1101007) if sm.sendAskYesNo("Yer sure about this? Remember, ye can't change yer mind, so ye'll want to pick carefully. Ye really want to join me as a Thunder Breaker?"): sm.setSpeakerID(1101007) sm.sendNext("Just like tha...
""" 1. get the user,pwd and current sold from the console 2. validate the user and password 3. Enable the login through an enter 4. Display the sold after the login 5. Retrieve an amount of cash 6. Display the password encrypted e.g. instead of 'abcd' show '****'. 7. Be aware that the nr of '*' should be equal with the...
""" Author: Trevor Stalnaker, Justin Pusztay File: fsm.py A class that models a finite state machine """ class FSM(): """ Models a generalized finite state machine """ def __init__(self, startState, states, transitions): self._state = startState self._startState = startState s...
#!/usr/bin/env python # -*- coding: utf-8 -*- arr = [6,5,4,2,1,8,3] def qsort(l, r): global arr if l >= r: return first, last, key = l, r, arr[l] while first < last: while first < last and arr[last] >= key: last -= 1 arr[first] = arr[last] while first < last and arr[first] <= key...
print('Exercício Python #025 - Procurando uma string dentro de outra') print('By Guanabara') name = str(input('Qual é o seu nome? ')).title().strip() print('Seu nome tem Silva? {}'.format('Silva' in name))
retas_convertidas = { '75': '38', # Ladrilho de início '77': '37', # Ladrilho de início com paredes '76': '36', # Ladrilho de início sem linha '78': '11', # Ladrilho final '80': '10', # Ladrilho final com paredes '73': '8', # Terceira Sala '54': '4', # Co...
def test_accounts(client): client.session.get.return_value.json.return_value.update({'accounts': [1, ]}) client.accounts() client.session.get.called_once_with('https://api.getdrip.com/v2/accounts/') def test_account(client): client.session.get.return_value.json.return_value.update({'accounts': [1, ]...