Created
April 6, 2021 19:48
-
-
Save josivantarcio/c78f8450c4a923245353ae8f9dafd156 to your computer and use it in GitHub Desktop.
challengePython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="InspectionProjectProfileManager"> | |
<settings> | |
<option name="USE_PROJECT_PROFILE" value="false" /> | |
<version value="1.0" /> | |
</settings> | |
</component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<component name="InspectionProjectProfileManager"> | |
<profile version="1.0"> | |
<option name="myName" value="Project Default" /> | |
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true"> | |
<option name="ignoredErrors"> | |
<list> | |
<option value="W391" /> | |
</list> | |
</option> | |
</inspection_tool> | |
</profile> | |
</component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/CursoemVideoDesafio.iml" filepath="$PROJECT_DIR$/.idea/CursoemVideoDesafio.iml" /> | |
</modules> | |
</component> | |
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print('Olá Mundo!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nome = input('Digite seu nome ') | |
print('Seja bem vindo {}'.format(nome)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1 = int(input('Digite um valor ')) | |
n2 = int(input('Digite outro valor ')) | |
soma = n1+n2 | |
print('A soma de {} e {} foi {}'.format(n1,n2,soma)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = (input('Digite um valor ')) | |
print(type(a)) | |
print('O valor é Numerico? ',a.isnumeric()) | |
print('O valor é Alfabeto? ',a.isalpha()) | |
print('O valor está em Maiusculo? ',a.isupper()) | |
print('O valor está em Minusculo? ',a.islower()) | |
print('O valor tem espaço? ',a.isspace()) | |
print('O valor possui numeros ou letras? ',a.isalnum()) | |
print('O valor está "capitalizado", ou seja, maiusculo e minusculo? ',a.istitle()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite o numero ')) | |
print('O numero anterior é {}'.format(n-1)) | |
print('O numero seguinte é {}'.format(n+1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite um numero ')) | |
print('O doble é {}, o triplo é {} e sua raiz quadrada é {:.2f} '.format((n*2),(n*3),(n**(1/2)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nt1 = float(input('digite a nota 1 ')) | |
nt2 = float(input('digite a nota 2 ')) | |
print('A media do aluno foi: {:.2f}'.format((nt1+nt2)/2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = float(input('Digite um valor inteiro ')) | |
dm = v * 10 | |
cm = v * 100 | |
mm = v * 1000 | |
dam = v * 0.1 | |
hm = v * 0.01 | |
km = v * 0.001 | |
print('valor de {} é de {} mm'.format(v,mm)) | |
print('valor de {} é de {} dm'.format(v,dm)) | |
print('valor de {} é de {} cm'.format(v,cm)) | |
print('valor de {} é de {} dam'.format(v,dam)) | |
print('valor de {} é de {} hm'.format(v,hm)) | |
print('valor de {} é de {} km'.format(v,km)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('digite um valor ')) | |
i=0 | |
print('-' * 13) | |
while(i<=10): | |
print('{} x {:2} = {}'.format(n, i, (n*i))) | |
i += 1 | |
print('-' * 13) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S = float(input('valor em real ')) | |
usd = 3.27 | |
print('Pode comprar US${:.2f}'.format(S/usd)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = float(input('digite a altura (M) ')) | |
l = float(input('digite a largura (M) ')) | |
area = a * l | |
tinta = 2 | |
areaPintada = area /tinta | |
print('A area é de {:.2f}M² e Precisa de {:.2f}l de tinta para pintar!'.format(area,areaPintada)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
preco = float(input('digite o valor: ')) | |
desconto = 0.05 | |
print('Apos o desconto, o valor será de R${:.2f}'.format(preco-desconto*preco)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
salario = float(input('Digite o salario do funcionario (R$) ')) | |
ajusteSalarial = 0.15 | |
print('Com ajuste o salário será R${:.2f}'.format(salario+salario*ajusteSalarial)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c = float(input('Digite a temperatura (ºC) ')) | |
f = 1.8 * c + 32 | |
print('A temperatura {}ºC em Farenheit é {}ºF'.format(c,f)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
km = float(input('Quantidade de KM? ')) | |
km = km * 0.15 | |
d = int(input('Quantidade de dias? ')) | |
d = d * 60.00 | |
valor = km + d | |
print('Valor a Pagar R${:.2f}'.format(valor)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = float(input('digite um valor: ')) | |
print('valor digitado foi {} e seu numero inteiro é: {}'.format(i,int(i))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import math | |
# ca = float(input('Valor do Cateto adjacente: ')) | |
# co = float(input('Valor do Cateto Oposto: ')) | |
# ca = ca**2 | |
# co = co**2 | |
# h = math.sqrt(ca + co) | |
# print('A Hipotenusa é: {:.2f}'.format(h)) | |
################################################## | |
from math import hypot | |
ca = float(input('Valor do Cateto adjacente: ')) | |
co = float(input('Valor do Cateto Oposto: ')) | |
hi = hypot(ca,co) | |
print('A Hipotenusa é: {:.2f}'.format(hi)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sin, radians, cos, tan | |
ang = float(input('Digite o valor: ')) | |
sen = sin(radians(ang)) | |
cose = cos(radians(ang)) | |
tang = tan(radians(ang)) | |
print('No angulo de {}, O Seno é {:.2f}, Cosseno é {:.2f} e a Targente é {:.2f}'.format(ang, sen, cose, tang,)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import choice | |
q = int(input('quantidade de alunos? ')) | |
nome = [] | |
for i in range(q): | |
x = (input('Digite o nome do aluno: ')) | |
nome.append(x) | |
sorteado = choice(nome) | |
print('O aluno sorteado foi... {}'.format(sorteado)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import shuffle | |
n = int(input('Quantidade de Alunos: ')) | |
nome = [] | |
for x in range(n): | |
n = (input('Digite o nome do Aluno nº {}: '.format(x+1))) | |
nome.append(n) | |
shuffle(nome) | |
print(nome) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pygame import mixer, event | |
from datetime import time | |
mixer.init() | |
print('\033[1;34mTocando...') | |
time(1) | |
mixer.music.load('10_Eu_Jamais_Serei_o_Mesmo_Onde_Quer_Que_For_Irei_Acústico.mp3') | |
mixer.music.play(0) | |
input() | |
event.wait() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nome = (input('Digite nome completo ')) | |
print('Maiusculo: {}'.format(nome.upper())) | |
print('Minusculo: {}'.format(nome.lower())) | |
nomeQuebrado = nome.split() | |
nome = '.'.join(nomeQuebrado) | |
i = len(nome) | |
j = nome.count('.') | |
print('quantidade de caracteres {} '.format(i-j)) | |
nome = len(nomeQuebrado[0]) | |
print(('{} - Quantidade de caracteres do primeiro nome: {}'.format(nomeQuebrado[0], nome))) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
milhar = int(input('Digite uma milhar: ')) | |
u = milhar // 1 % 10 | |
d = milhar // 10 % 10 | |
c = milhar // 100 % 10 | |
m = milhar // 1000 % 10 | |
print('\033[1;33munidade: {:}'.format(u)) | |
print('dezena: {}'.format(d)) | |
print('centena: {}'.format(c)) | |
print('milhar: {}'.format(m)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cidade = input('Digite o nome da sua cidade: ') | |
cidade = cidade.lower() | |
cidadeq = cidade.split() | |
if cidadeq[0] == 'santo': | |
print('A cidade {}, começa nome de Santo! '.format(cidade)) | |
else: | |
print('A cidade {}, não inicia com nome de santo {}!'.format(cidade, cidadeq[0])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nome = input('Digite o nome completo de uma pessoa! ') | |
nome = nome.lower() | |
if 'silva' in nome: | |
print('Possui sim') | |
else: | |
print('Nao possui') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frase = str(input('Digite uma frase: ')) | |
frase = frase.lower().strip() | |
print('A frase possui {} letras A.'.format(frase.count('a'))) | |
print('Aparece a primeira na posicao {}.'.format(frase.find('a'))) | |
print('Aparece a ultima na posicao {}.'.format(frase.rfind('a'))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nome = input('Digite nome completo ') | |
nome = nome.title() | |
nome = nome.split() | |
cont = len(nome) | |
print(nome[0],end=' ') | |
print(nome[cont-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
cpu = randint(0,5) | |
usuario = int(input('Digite um numero entre 0 a 5: ')) | |
if(cpu == usuario): | |
print('\033[33;mAcertô, mizeravi!') | |
else: | |
print('Errou Zé Ruela') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vel = float(input('Velocidade do veículo: ')) | |
velMax = 80 | |
taxa= 7.00 | |
if(vel > velMax): | |
multa = (vel - velMax) * taxa | |
print('Você ultrapassou o limite de velocidade! Pagar multa de R${:.2f}'.format(multa)) | |
print('Dirija com Cuidado!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite um numero')) | |
if(n % 2 == 0): | |
print('Número é Par!') | |
else: | |
print('Número é Impar!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
distancia = float(input('Digite a distancia: ')) | |
if(distancia <= 200): | |
valor = distancia * 0.50 | |
else: | |
valor = distancia * 0.45 | |
print('valor da passagem: R${:.2f}'.format(valor)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
ano = int(input('Digite o ano desejado: ')) | |
if ano == 0: | |
ano = date.today().year | |
if(ano % 4 == 0 and ano % 100 != 0 and ano % 400 == 0): | |
print('{} é Bissexto'.format(ano)) | |
else: | |
print('{} não é Bissexto'.format(ano)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1 = float(input('Digite nº1: ')) | |
n2 = float(input('Digite nº2: ')) | |
n3 = float(input('Digite nº3: ')) | |
# if(n1 > n2 and n1 > n3): | |
# print('{} é o maior'.format(n1)) | |
# elif(n3 > n2 and n3 > n1): | |
# print('{} é o maior'.format(n3)) | |
# else: | |
# print('{} é o maior'.format(n2)) | |
menor = n1 | |
if n2<n1 and n2<n3: | |
menor = n2 | |
if n3<n1 and n3<n2: | |
menor= n3 | |
maior = n1 | |
if n2>n1 and n2>n3: | |
maior = n2 | |
if n3>n1 and n3>n2: | |
maior = n3 | |
print('O Menor é {}'.format(menor)) | |
print('O Maior é {}'.format(maior)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
salario = float(input('Digite o valor do funcionario R$: ')) | |
if(salario <= 1250): | |
salario = salario + salario * 0.15 | |
else: | |
salario = salario + salario * 0.10 | |
print('O Salario do Funcionario será de R$:{:.2f}'.format(salario)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r1 = float(input('Lado 1: ')) | |
r2 = float(input('Lado 2: ')) | |
r3 = float(input('Lado 3: ')) | |
if(r1 < r2 + r3) and (r2 < r1 + r3) and (r3 < r1 + r2): | |
print('É triangulo!') | |
else: | |
print('Não é triangulo') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valorCasa = float(input('Valor da Casa: R$ ')) | |
salario = float(input('Salário: R$ ')) | |
duracao = 12 * int(input('Pagar em quantos meses: ')) | |
parcela = valorCasa / duracao | |
if parcela > (salario*30/100): | |
print('Infelizmente, seu crédito não foi aprovado') | |
print('Valor da Parcela {:.2f}, é superior a ' | |
'30% do salário mensal: {}'.format(parcela, salario)) | |
else: | |
print('_-' * 20) | |
print('Parabéns seu crédito foi aprovado. Ficará:') | |
print('PARCELA: R${:.2f}\Mês\nDURACAO: {}'.format(parcela, duracao)) | |
print('='*20) | |
print('\033[1;33mSalario: R${:.2f}'.format(salario)) | |
print('\033[1;34m30% Salário: R${:.2f}'.format(salario*30/100)) | |
print('\033[1;35mParcela: R${:.2f}\033[m'.format(parcela)) | |
print('='*20) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numero = int(input('Digite um numero ')) | |
print('Digite:\n [1] - para Binario;\n [2] - para Octal;\n [3] - para hexadecial') | |
escolha = int(input()) | |
if escolha == 1: | |
numero = bin(numero) | |
elif escolha == 2: | |
numero = oct(numero) | |
elif escolha == 3: | |
numero = hex(numero) | |
else: | |
print('numero invalido') | |
print(numero[2:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1 = int(input('Digite 1º número: ')) | |
n2 = int(input('Digite 2º número: ')) | |
if n1 > n2: | |
print('-O \033[1;33mprimeiro valor\033[m é \033[1;34mmaior\033[m') | |
elif n1 < n2: | |
print('-O \033[1;33mseguundo valor\033[m é \033[1;34mmaior\033[m') | |
else: | |
print('\033[1;33m- Não existe\033[m valor maior,os dois são \033[0;34miguais\033[m') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
ano = int(input('informe o ano de nascimento ')) | |
anoSys = date.today().year | |
idade = anoSys-ano | |
print(idade) | |
if idade < 18: | |
tempo = 18 - idade | |
print('\033[1;33mAinda vai se alistar!, falta {} anos'.format(tempo)) | |
elif idade == 18 or idade == 19: | |
print('\033[1;33mHora de se Alistar!') | |
elif idade > 19: | |
tempo = idade - 19 | |
print('\033[1;33mPassou do Tempo! Já se passaram {} anos'.format(tempo)) | |
print('Seu ano foi/será em {}'.format(ano+18)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nota1 = float(input('Digite a 1ª Nota: ')) | |
nota2 = float(input('Digite a 2ª Nota: ')) | |
media = (nota1 + nota2) / 2 | |
if(media < 5.0): | |
print('Média abaixo de \033[1;33m5.0:\n\033[1;31mREPROVADO') | |
elif(media >= 5.0 and media <= 7): | |
print('Média entre de 5.0 e 6.9\033[1;33m:\nRECUPERAÇÃO') | |
elif(media >=7.0 and media <=10.0): | |
print('Média entre de 7.0 e 10.0\033[1;33m\n\033[1;34mAPROVADO') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
ano = int(input('Digite o ano de nascimento: ')) | |
anoCorrente = date.today().year | |
idade = anoCorrente - ano | |
if(idade <= 9): | |
print('Atleta \033[1;34mMirim') | |
elif(idade <= 14): | |
print('Atleta \033[1;34mInfantil') | |
elif(idade <= 19): | |
print('Atleta \033[1;34mJunior') | |
elif(idade <= 25): | |
print('Atleta \033[1;34mSênior') | |
else: | |
print('Atleta \033[1;34mMaster') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l1 = float(input('Digite lado 1: ')) | |
l2 = float(input('Digite lado 2: ')) | |
l3 = float(input('Digite lado 3: ')) | |
if l1 + l2 > l3 and l2 + l3 > l1 and l3 + l1 >l2: | |
if l1 == l2 == l3: | |
print('Triangulo Equilátero') | |
elif l1 == l2 or l2 == l3 or l1 == l3: | |
print('Triangulo Isósceles') | |
else: | |
print('Triangulo Escaleno') | |
else: | |
print('Não é um Triangulo') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
peso = float(input('Digite o peso: ')) | |
altura = float(input('Digite a altura: ')) | |
imc = peso / altura ** 2 | |
if(imc < 18.5): | |
print('Abaixo do Peso!') | |
elif(imc >= 18.5 and imc < 25.0): | |
print('Peso Ideal') | |
elif(imc >= 25.0 and imc < 30.0): | |
print('Sobrepeso') | |
elif(imc >= 30.0 and imc < 40.0): | |
print('Obesidade') | |
else: | |
print('Obesidade Mórbida') | |
print('{:.2f}'.format(imc)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
preco = float(input('Valor do Produto: R$')) | |
formaPagamento = str(input('Forma de Pagamento: ')).strip() | |
if 'a vista' in formaPagamento: | |
formaVista = str(input('Cartão, Dinheiro ou Cheque?\n')).strip() | |
if 'cartao' not in formaVista: | |
precofinal = preco - preco * 10 / 100 | |
else: | |
precofinal = preco - preco * 5 / 100 | |
else: | |
parcela = int(input('Quantidade de Parcelas: ')) | |
if(parcela == 2): | |
precofinal = preco | |
else: | |
precofinal = preco + preco * 20 / 100 | |
parcela = precofinal/parcela | |
print('O valor da parcela R$ \033[1;31m{:.2f}\033[m'.format(parcela)) | |
print(formaPagamento) | |
print('O valor final foi de R$ \033[1;33m{:.2f}\033[m'.format(precofinal)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import time | |
armas = ('pedra','papel','tesoura') | |
nome = str(input('Digite seu nome: ')).upper() | |
print('''Escolha sua arma {}! | |
[ 0 ] - Para \033[1;34mPedra\033[m; | |
[ 1 ] - Para \033[1;34mPapel\033[m; | |
[ 2 ] - Para \033[1;34mTesoura\033[m | |
[ 9 ] - Para \033[1;31mFinalizar\033[m;'''.format(nome)) | |
jogador = int(input(':_')) | |
print('é (1)...',end='') | |
time.sleep(0.5) | |
print('(2)...',end='') | |
time.sleep(0.5) | |
print('(3)...',end='') | |
time.sleep(0.5) | |
print('eee JÁ!!!\n') | |
time.sleep(1) | |
wj = 0 | |
wc = 0 | |
while jogador != 9: | |
cpu = random.randint(0, 2) | |
if cpu == 0: ##pedra | |
if jogador == 0: #pedra | |
print('EMPATE') | |
elif jogador == 1: #papel | |
print('JOGADOR WIN') | |
wj += 1 | |
elif jogador == 2: #tesoura | |
print('CPU WIN') | |
wc += 1 | |
elif cpu == 1: ##papel | |
if jogador == 0: #pedra | |
print('CPU WIN') | |
wc += 1 | |
elif jogador == 1: #papel | |
print('EMPATE') | |
elif jogador == 2: #tesoura | |
print('JOGADOR WIN') | |
wj += 1 | |
elif cpu == 2: ##tesoura | |
if jogador == 0: #pedra | |
print('JOGADOR WIN') | |
wj += 1 | |
elif jogador == 1: #papel | |
print('CPU WIN') | |
wc += 1 | |
elif jogador == 2: #tesoura | |
print('EMPATE') | |
print('='*15) | |
print('CPU X {}'.format(nome)) | |
jogador = int(input(':_')) | |
print('é (1)...',end='') | |
time.sleep(0.5) | |
print('(2)...',end='') | |
time.sleep(0.5) | |
print('(3)...',end='') | |
time.sleep(0.5) | |
print('eee JÁ!!!\n') | |
time.sleep(1) | |
print('Fim do Jogo!') | |
print('CPU X {}'.format(nome)) | |
print('{} X {}'.format(wc,wj)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
for i in range(10, 0, -1): | |
print(i) | |
sleep(1) | |
print('Feliz Ano Novo!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in range(2, 51, 2): #numeros pares de 1 a 50 | |
print(i, end=' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
soma = 0 | |
for i in range(1, 501, 2): | |
if(i % 3 == 0): | |
soma += i | |
print(soma) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Calculadora de: ')) | |
op = str(input('''Operação: | |
[ + ] - Soma; | |
[ - ] - Subtração; | |
[ * ] - Multiplicação; | |
[ / ] - Divisão; | |
[ P ] - Potência; | |
[ % ] - Resto.\n''')) | |
for i in range(0, 11): | |
if '+' in op: | |
print('{:2} + {} = {:2}'.format(i, n, i + n)) | |
elif '-' in op: | |
print('{:2} - {} = {:2}'.format(i, n, i - n)) | |
elif '*' in op: | |
print('{:2} x {} = {:2}'.format(i, n, i * n)) | |
elif '/' in op: | |
print('{:2} / {} = {:2}'.format(i, n, i / n)) | |
elif 'P' in op: | |
print('{:2} ** {} = {:2}'.format(i, n, i ** n)) | |
elif '%' in op: | |
print('{:2} % {} = {:2}'.format(i, n, i % n)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
soma = 0 | |
for i in range(1, 7): | |
n = int(input('Digite o numero {}: '.format(i))) | |
if n % 2 == 0: | |
soma += n | |
print(soma) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#an = a1 + (n - 1) * r | |
a1 = int(input('Primeiro Termo: ')) | |
r = int(input('Razao: ')) | |
an = a1 + (10 - 1) * r | |
for i in range(a1, an + r, r): | |
print(i,end=' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite um numero: ')) | |
cont = 0 | |
for i in range(1, n+1): | |
if n % i == 0: | |
print('\033[1;34m',end=' ') | |
cont +=1 | |
else: | |
print('\033[m',end=' ') | |
print(i,end=' ') | |
if cont == 2: | |
print('\n\033[mPrimo') | |
else: | |
print('\n\033[mNão é Primo') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frase = str(input('Digite a frase: ')).strip().upper() | |
palavras = frase.split() | |
juntarPalavras = ''.join(palavras) | |
trocar = juntarPalavras[::-1] | |
print(trocar) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
today = date.today().year | |
maior = 0 | |
menor = 0 | |
for i in range(1,8): | |
idade = int(input('Digite o ano de nascimento: ')) | |
if (today - idade) >= 18: | |
maior += 1 | |
else: | |
menor += 1 | |
print('Maiores: {}\nMenores: {}'.format(maior, menor)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pesoMaior = 0 | |
pesoMenor = pesoMaior | |
for i in range(1, 6): | |
peso = float(input('Digite o peso: ')) | |
if i == 1: | |
pesoMaior = peso | |
pesoMenor = peso | |
else: | |
if peso > pesoMaior: | |
pesoMaior = peso | |
if peso < pesoMenor: | |
pesoMenor = peso | |
print('O Maior peso: {}\nO Menor peso: {}'.format(pesoMaior, pesoMenor)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
idadeMaior = 0 | |
idadeMedia = 0 | |
nomeHomemVelho = ' ' | |
mulheres = 0 | |
for i in range(1, 5): | |
nome = str(input('Digite o nome da pessoa n{}: '.format(i))).upper().strip() | |
idade = int(input('Digite a idade da pessoa n{}: '.format(i))) | |
sexo = str(input('Digite o sexo da pessoa n{}: '.format(i))).upper().strip() | |
idadeMedia += idade | |
idadeMedia = idadeMedia / i | |
if i == 1 and sexo in 'Mm': | |
nomeHomemVelho = nome | |
idadeMaior = idade | |
if sexo in 'Mm' and idadeMaior < idade: | |
idadeMaior = idade | |
nomeHomemVelho = nome | |
if sexo in 'Ff' and idade < 20: | |
mulheres += 1 | |
print('A média das idades é de {:.1f} anos'.format(idadeMedia)) | |
print('O Homem mais velho do grupo {} tem {} anos'.format(nomeHomemVelho, idadeMaior)) | |
print('O grupo possui {} Mulher com idade abaixo de 20 anos'.format(mulheres)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sexo = str(input('Sexo M/F: ')).strip().upper() | |
while sexo not in 'MmFf': | |
print('Valor errado, favor digitar novamente!') | |
sexo = str(input('Sexo M/F: ')).strip().upper() | |
print('Sexo = {}'.format(sexo)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
n = int(input('Digite um numero: ')) | |
cpu = randint(0, 10) | |
cont = 0 | |
while n != cpu: | |
cont += 1 | |
print('Errou! Tentar novamente...') | |
n = int(input('Digite um numero: ')) | |
print('*' * 20) | |
print('Acertou!') | |
print('Foram {} tentativas'.format(cont)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n1 = int(input('Digite número 1: ')) | |
n2 = int(input('Digite número 2: ')) | |
menu = 0 | |
while menu != 5: | |
print('''Digite: | |
[1] - Somar; | |
[2] - Multiplicar; | |
[3] - Maior; | |
[4] - Novos Números; | |
[5] - Sair do Programa.''') | |
menu = int(input()) | |
if menu == 1: | |
print('Soma: {}'.format(n1 + n2)) | |
elif menu == 2: | |
print('Multiplicação: {} '.format(n1 * n2)) | |
elif menu == 3: | |
n1 > n2 if print('O primeiro é maior!') else print('O Segundo é Maior!') | |
elif menu == 4: | |
n1 = int(input('Digite número 1: ')) | |
n2 = int(input('Digite número 2: ')) | |
print('FIM') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite um numero: ')) | |
cont = m = n | |
while cont != 1: | |
cont -= 1 | |
m = m * cont | |
print(m) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cont = 0 | |
ptermo = int(input('Primeiro termo: ')) | |
razao = int(input('Razão da PA: ')) | |
while cont != 10: | |
print(ptermo,end=' ') | |
ptermo += razao | |
cont += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pTermo = int(input('Informe Primeiro Termo: ')) | |
razao = int(input('Informe a Razão: ')) | |
cont = 0 | |
total = 0 | |
mais = 10 | |
while mais != 0: | |
total += mais | |
while cont != total: | |
print('{} . '.format(pTermo),end='') | |
pTermo += razao | |
cont += 1 | |
print() | |
mais = int(input('Quantos Termos voce quer mostrar a mais? ')) | |
print(total) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite um numero ')) | |
t1 = 0 | |
t2 = 1 | |
cont = 3 | |
print(t1, t2, end=' ') | |
while cont <= n: | |
t3 = t1 + t2 | |
cont += 1 | |
t1 = t2 | |
t2 = t3 | |
print('{} '.format(t3),end='') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cont = 0 | |
acomulador = 0 | |
n = 0 | |
n = int(input('Digite um numero ')) | |
while n != 999: | |
cont += 1 | |
acomulador += n | |
n = int(input('Digite um numero ')) | |
print('Quantidade: {}\nSoma: {}'. format(cont, acomulador)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sinal = 's' | |
cont = 0 | |
acomulador = 0 | |
while sinal not in 'Nn': | |
n = int(input('Digite um valor: ')) | |
acomulador += n | |
cont += 1 | |
if cont == 1: | |
nMaior = nMenor = n | |
else: | |
if n > nMaior: | |
nMaior = n | |
if n < nMenor: | |
nMenor = n | |
sinal = str(input('Quer continuar? ')) | |
media = acomulador / cont | |
print(f'O Total foi de {acomulador}\nA Média de {cont} foi de {media:.2f}\n' | |
f'E o maior número foi: {nMaior}\nE o menor número foi: {nMenor}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
soma = contador = 0 | |
while True: | |
n = int(input('Digite um numero: ')) | |
if n == 999: | |
break | |
soma += n | |
contador += 1 | |
print(f'A soma deu {soma} e foram {contador} numeros digitados') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input('Digite um numero: ')) | |
i = 0 | |
while n >= 0: | |
while True: | |
print(f'{i} x {n} = {i * n}') | |
i += 1 | |
if i > 10: | |
break | |
i = 0 | |
n = int(input('Digite um numero: ')) | |
print('FIM') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
vitoria = 0 | |
while True: | |
cpu = randint(0, 10) | |
while True: | |
eJogador = str(input('Par ou Impar? ')).strip().lower() #escolha jogador | |
if eJogador in 'par' or eJogador in 'impar': | |
break | |
nJogador = int(input('Digite um numero: ')) | |
soma = cpu + nJogador | |
if soma % 2 == 0: | |
resultado = 'par' | |
else: | |
resultado = 'impar' | |
if eJogador == resultado: | |
vitoria += 1 | |
else: | |
print(f'Você Perdeu! {cpu} + {nJogador} = {soma}. E ele é {resultado.title()}!') | |
break | |
print(f'Total de Vitória(s): {vitoria}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
somaIdade = somaHomem = somaMulher = 0 | |
while True: | |
while True: | |
idade = int(input('Digite a idade: ')) | |
if (idade > 0): | |
break | |
while True: | |
sexo = str(input('Digite o Sexo M/F: ')).strip().upper()[0] | |
if sexo in 'M' or sexo in 'F': | |
break | |
if(idade > 18): | |
somaIdade += 1 | |
if(sexo in 'Mn'): | |
somaHomem += 1 | |
if(sexo in 'Ff' and idade < 20): | |
somaMulher += 1 | |
while True: | |
i = str(input('Deseja continuar? ')).strip().lower()[0] | |
if(i in 'Nn' or i in 'Ss'): | |
break | |
if(i in 'Nn'): | |
break | |
print(f'{somaIdade} Pessoas com mais de 18 anos;\n' | |
f'{somaHomem} Total de Homem cadastrado;\n' | |
f'{somaMulher} Total de Mulher abaixo de 20 anos.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total = conteMaiorqMil = 0 | |
cont = 0 | |
while True: | |
prod = str(input('Nome do Produto: ')).strip().title() | |
preco = float(input(f'Preço do {prod} R$: ')) | |
total += preco | |
cont += 1 | |
if(cont == 1 or preco < menorPreco): | |
menorPreco = preco | |
menorProd = prod | |
if(preco > 1000): | |
conteMaiorqMil += 1 | |
while True: | |
i = str(input('Deseja continuar? ')).strip().lower()[0] | |
if(i in 'Ss' or i in 'Nn'): | |
break | |
if(i in 'Nn'): | |
break | |
print(f'O total gasto foi de R${total:.2f}; Itens: {cont}\n' | |
f'Possui {conteMaiorqMil} produtos acima de R$ 1000,00;\n' | |
f'O produto mais barato foi: {menorProd}, custando R${menorPreco:.2f}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saque = int(input('Informe o valor desejado para saque! R$ ')) | |
if saque >= 100: | |
conte100 = saque // 100 | |
saque = saque % 100 | |
if conte100 != 0: | |
print(f'{conte100} cédula(s) de 100,00') | |
if saque >= 50: | |
conte50 = saque // 50 | |
saque = saque % 50 | |
if conte50 != 0: | |
print(f'{conte50} cédula(s) de 50,00') | |
if saque >= 20: | |
conte20 = saque // 20 | |
saque = saque % 20 | |
if conte20 != 0: | |
print(f'{conte20} cédula(s) de 20,00') | |
if saque >= 10: | |
conte10 = saque // 10 | |
saque = saque % 10 | |
if conte10 != 0: | |
print(f'{conte10} cédula(s) de 10,00') | |
if saque >= 5: | |
conte5 = saque // 5 | |
saque = saque % 5 | |
if conte5 != 0: | |
print(f'{conte5} cédula(s) de 5,00') | |
if saque >= 1: | |
conte1 = saque // 1 | |
saque = saque % 1 | |
if conte1 != 0: | |
print(f'{conte1} cédula(s) de 1') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext = ('zero', 'um', 'dois', 'tres','quatro','cinco', | |
'seis','sete','oito','nove','dez', | |
'onze','doze','treze','quatorze','quinze', | |
'dezesseis','sezessete','dezoito','dezenove','vinte') | |
while True: | |
while True: | |
n = int(input('Digite um número: ')) | |
if n >= 0 and n <= 20: | |
break | |
print(ext[n]) | |
rt = str(input('Quer continnuar? S/N ')).strip().upper()[0] | |
if rt in 'Nn': | |
break | |
print('FIM') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
times = ('Flamengo','Internacional','Atlético-MG','São Paulo','Fluminense','Grêmio','Palmeiras','Santos', | |
'Athletico-PR','Bragantino','Ceará','Corinthians','Atlético-GO',\ | |
'Bahia','Sport','Fortaleza','Vasco','Goiás','Coritiba','Botafogo') | |
print(f'Times do Brasileirão 2020/2021: {times}') | |
print(f'Os cinco primeiros: {times[0:5]}') | |
print(f'Os quatros últimos: {times[-4:]}') | |
print(sorted(times)) | |
print(times.index('Flamengo')+1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
for i in range(5): | |
n = (randint(0,10)) | |
if(i == 0): | |
m = n | |
M = n | |
if (n > M): | |
M = n | |
elif (n < m): | |
m = n | |
print(n, end=' ') | |
print(f'\nO maior número foi {M}\nE o Menor foi {m}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = (int(input('Digite um valor: ')), | |
int(input('Digite um valor: ')), | |
int(input('Digite um valor: ')), | |
int(input('Digite um valor: '))) | |
print('quantidade de Nove: ',n.count(9)) | |
print('posicao do nr. 3: ',n.index(3)) | |
for i in n: | |
if i % 2 == 0: | |
print(i, end=' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prod = (input('Digite produto: '),input('Digite o Preco: '), | |
input('Digite produto: '),input('Digite o Preco: '), | |
input('Digite produto: '),input('Digite o Preco: '), | |
input('Digite produto: '),input('Digite o Preco: ')) | |
print('=' * 29) | |
print('Tabela de Preço') | |
print('=' * 29) | |
for i in range(len(prod)): | |
if i % 2 == 0: | |
print(f'{prod[i]:.<23}',end='') | |
else: | |
print(f'R${prod[i]}') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista = ('carro','moto','trator','caminhao','coracao','ovo', | |
'mao','paralelepipedo','borboleta','onibus','Brasil','papai') | |
for i in lista: | |
print(f'\nA palavra {i}, possui as vogais: ',end='') | |
for j in i: | |
if j.lower() in 'aeiou': | |
print(j, end=' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numeros = list() | |
maiorPosicao = list() | |
menorPosicao = list() | |
for i in (range(5)): | |
numeros.append(int(input('Digite o valor: '))) | |
maior = max(numeros) | |
menor = min(numeros) | |
for c, i in enumerate(numeros): | |
if i == maior: | |
maiorPosicao.append(c) | |
if i == menor: | |
menorPosicao.append(c) | |
print(f'Voce digitou os valores {numeros}') | |
print(f'{maior} é o maior número e está nas posicões {maiorPosicao}') | |
print(f'{menor} é o menor número e está nas posicões {menorPosicao}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numeros = list() | |
n = 0 | |
while True: | |
n = (int(input('Digite um valor: '))) | |
if n not in numeros: | |
numeros.append(n) | |
else: | |
print('Valor ja existe!') | |
stop = str(input('Deseja Continuar? ').strip().lower()[0]) | |
if stop == 'n': | |
break | |
numeros.sort() | |
print(numeros) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valores = list() | |
for i in range(5): | |
n = int(input('Digite um valor: ')) | |
if i == 0 or n > valores[-1]: | |
valores.append(n) | |
else: | |
pos = 0 | |
while pos < len(valores): | |
if n <= valores[pos]: | |
valores.insert(pos, n) | |
break | |
pos += 1 | |
print(valores) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [] | |
while True: | |
a.append(int(input('Digite o valor: '))) | |
st = str(input('Deseja continuar? S/N ').strip()[0].lower()) | |
if st in 'n': | |
break | |
a.sort(reverse=True) | |
if 5 in a: | |
print(f'O número 5 faz parte da lista e aparece {a.count(5)} vezes!') | |
else: | |
print('O número 5 não faz parte da lista') | |
print(f'{len(a)} -> quantidade de números') | |
print(f'{a} -> do maior para o menor') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista = list() | |
pares = list() | |
impares = list() | |
while True: | |
lista.append((int(input("Digite um valor: ")))) | |
stp = str(input('Deseja continuar? S/N ').lower()[0].strip()) | |
if stp in 'n': | |
break | |
for i in lista: | |
if i % 2 == 0: | |
pares.append(i) | |
else: | |
impares.append(i) | |
print(lista) | |
print(f'Impares -> {impares}') | |
print(f'Pares -> {pares}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expressao = list() | |
expressao.append(str(input('Digite a expressão: '))) | |
for i in expressao: | |
i.split() | |
d = i.count(')') | |
e = i.count('(') | |
if d == e: | |
print('Expressão Correta!') | |
else: | |
print('Erro na Expressão') | |
print(expressao) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pessoa = list() | |
t = [] | |
maior = menor = 0 | |
while True: | |
t.append(str(input('Nome: ').title())) | |
t.append(float(input('Peso: '))) | |
if len(pessoa) == 0: | |
maior = menor = t[1] | |
else: | |
if t[1] > maior: | |
maior = t[1] | |
else: | |
menor = t[1] | |
pessoa.append(t[:]) | |
t.clear() | |
stp = str(input('Deseja continuar? ')).lower()[0] | |
if stp in 'n': | |
break | |
del(t) | |
print(f'Total de pessoas: {len(pessoa)}') | |
print(f'O maior peso foi de {maior} para as pessoas',end=' ') | |
for i in pessoa: | |
if i[1] == maior: | |
print(i[0],end=' ') | |
print(f'\nO menor peso foi de {menor} para as pessoas',end=' ') | |
for i in pessoa: | |
if i[1] == menor: | |
print(i[0],end=' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista = [[],[]] | |
for i in range(7): | |
n = (int(input(f'Digite o numero {i+1}: '))) | |
if n % 2 == 0: | |
lista[0].append(n) | |
else: | |
lista[1].append(n) | |
lista[0].sort() | |
lista[1].sort() | |
print(f'Lista dos pares {lista[0]}\nLista dos impares {lista[1]}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tab = [[0,0,0],[0,0,0],[0,0,0]] | |
for i in range(3): | |
for j in range(3): | |
tab[i][j] = (int(input(f'Digite um numero na posicao [{i}][{j}]: '))) | |
for i in range(3): | |
for j in range(3): | |
print(f'[{tab[i][j]:^5}]',end=' ') | |
print() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tab = [[],[],[]] | |
soma = somaTerceira = maior = 0 | |
for i in range(3): | |
for j in range(3): | |
tab[i].append(int(input(f'Digite o valor da posição [{i}][{j}]: '))) | |
if tab[i][j] % 2 == 0: | |
soma += tab[i][j] | |
if j == 2: | |
somaTerceira += tab[i][j] | |
if i == 1: | |
if j == 0 or tab[i][j] > maior: | |
maior = tab[i][j] | |
for i in range(3): | |
for j in range(3): | |
print(f'[{tab[i][j]:^5}]', end=' ') | |
print() | |
print(f'A soma dos pares: {soma}') | |
print(f'A Soma da Terceira coluna é: {somaTerceira}') | |
print(f'O Maior número da segunda coluna é: {maior}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
from time import sleep | |
n = int(input('Quantos jogos? ')) | |
jogos = [] | |
bola = 0 | |
bolao = [] | |
for i in range(n): | |
jogos.clear() | |
for j in range(6): | |
while bola in jogos or bola == 0: | |
bola = randint(1, 60) | |
jogos.append(bola) | |
jogos.sort() | |
print(jogos) | |
sleep(1.5) | |
bolao.append(jogos[:]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boletim = [] | |
temp = [] | |
while True: | |
temp.clear() | |
temp.append(str(input('Nome: ')).strip().title()) | |
temp.append(float(input('Nota 01: '))) | |
temp.append(float(input('Nota 02: '))) | |
stp = str(input('Deseja continuar? ').strip()[0].lower()) | |
boletim.append(temp[:]) | |
if stp in 'n': | |
break | |
print('=' * 36) | |
print(' BOLETIM ') | |
print('Nr Nome Média Situação') | |
print('=' * 36) | |
for c, i in enumerate(boletim): | |
for j in (boletim): | |
media = (i[1] + i[2]) / 2 | |
if media >= 7: | |
situacao = ('\033[1;32mAprovado\033[m') | |
elif media < 7 and media >= 5: | |
situacao = ('\033[1;33mRecuperação\033[m') | |
elif media < 5: | |
situacao = ('\033[1;31mReprovado\033[m') | |
print(f'{c:<4}{i[0]:<12}{media:<11}{situacao:>10}') | |
while True: | |
f = int(input('Deseja ver a nota de qual aluno? (999 p/ Sair)')) | |
if f == 999: | |
break | |
if f <= len(boletim): | |
print(f'As notas do aluno: {boletim[f][0]}, teve as notas {boletim[f][1]} e {boletim[f][2]}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aluno = {} | |
aluno['nome'] = str(input('Digite o nome: ')).strip().title() | |
aluno['media'] = float(input(f'Media de {aluno["nome"]}: ')) | |
if aluno['media'] >= 7: | |
aluno['situacao'] = 'Aprovado' | |
elif 7 > aluno['media'] >= 5: | |
aluno['situacao'] = 'Recuperação' | |
else: | |
aluno['situacao'] = 'Reprovado' | |
for k, v in aluno.items(): | |
print(f"{k} - {v}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
from time import sleep | |
from operator import itemgetter | |
jogo = {'jogador1':randint(1,6), | |
'jogador2':randint(1,6), | |
'jogador3':randint(1,6), | |
'jogador4':randint(1,6)} | |
for k, v in jogo.items(): | |
print(f'{k} jogou {v}') | |
sleep(0.5) | |
rk = {} | |
rk = sorted(jogo.items(),key=itemgetter(1),reverse=True) | |
print('='*24) | |
print(' == Ranking ==') | |
for i, v in enumerate(rk): | |
sleep(1) | |
print(f'{i+1}ºLugar,{v[0]} tirou {v[1]}') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import date | |
pessoa = {} | |
pessoa['nome'] = str(input('Nome: ')).strip().title() | |
anoNascimento = int(input('Ano de Nascimento: ')) | |
pessoa['idade'] = date.today().year - anoNascimento | |
if pessoa['idade'] >= 16: | |
pessoa['nCtps'] = str(input('Número da CTPS (0 - não tem): ')).strip().upper() | |
if pessoa['nCtps'] not in '0': | |
pessoa['inicioCtps'] = int(input('Ano de Contratação: ')) | |
if pessoa['inicioCtps'] - anoNascimento >= 16: | |
pessoa['salario'] = float(input('Salário: ')) | |
pessoa['aposentadoria'] = pessoa['inicioCtps'] + 35 - anoNascimento | |
else: | |
if pessoa['inicioCtps'] != 0: | |
del pessoa['inicioCtps'] | |
print(f'Erro no Ano da Carteira. A Assinatura deve ser a partir de {anoNascimento+16} para poder assinar a CTPS!') | |
for k, v in pessoa.items(): | |
print(f" => {k} tem o valor {v}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jogador = dict() | |
jogador['nome'] = str(input('Nome: ')).strip().title() | |
nPartida = int(input(f'Quantas partidas {jogador["nome"]} jogou? ')) | |
soma = 0 | |
for i in range(nPartida): | |
jogador['partida'+ str(i+1)] = int(input(f'Quantos gols na partida {i+1} ')) | |
soma += jogador['partida'+str(i+1)] | |
jogador['totalGols'] = soma | |
print(' === APROVEITAMENTO ===') | |
for k, v in jogador.items(): | |
print(f' ==> {k}, tem valor {v}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pessoa = {} | |
grupo = [] | |
muheres = [] | |
acimaMedia = [] | |
soma = 0 | |
while True: | |
pessoa['nome'] = str(input('Nome: ')).strip().title() | |
while True: | |
pessoa['sexo'] = str(input('Sexo M/F: ')).strip().upper()[0] | |
if pessoa['sexo'] in 'MF': | |
break | |
else: | |
print('ERRO! Favor digitar apenas M ou F!') | |
pessoa['idade'] = int(input('Idade: ')) | |
grupo.append(pessoa.copy()) | |
stp = str(input('Deseja continuar? (S/N) ')).strip()[0].lower() | |
if stp in 'n': | |
break | |
print('='* 40) | |
#A | |
print(f'Total de Pessoas {len(grupo)}') | |
#B | |
for i in grupo: | |
soma += i['idade'] | |
media = soma / len(grupo) | |
print(f'Media de Idade é de {media:.2f} anos') | |
#C | |
print('=' * 40) | |
print(' == Lista de Mulheres ==') | |
for i in grupo: | |
if i['sexo'] == 'F': | |
muheres.append(i) | |
for i in muheres: | |
print(f" -> {i['nome']:<7} com idade de {i['idade']} anos") | |
print(f"Total de ========== {len(muheres)}") | |
#D | |
print('=' * 40) | |
print(' == Lista Acima da Média ==') | |
for i in grupo: | |
if i['idade'] > media: | |
acimaMedia.append(i) | |
for i in acimaMedia: | |
print(f" -> {i['nome']:<7} com idade de {i['idade']} anos do sexo: {i['sexo']}") | |
print(f"Total de ========== {len(acimaMedia)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@josivantarcio
[email protected]