This file contains 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> | |
<component name="TestRunnerService"> | |
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |
</component> |
This file contains 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
#Descubra se o ano informado é bissexto ou não | |
import datetime | |
print('=====ESSE É UM ANO BISSEXTO?=====') | |
print('') | |
print('Vamos descobrir se um determinado ano é bissexto ou não?') | |
ano = int(input('Para isso, digite um ano aleatório ou 0 para utilizar o ano atual: ')) | |
print('') | |
if ano == 0: |
This file contains 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
#Descubra se o ano informado é bissexto ou não | |
print('=====ESSE É UM ANO BISSEXTO?=====') | |
print('') | |
print('Vamos descobrir se um determinado ano é bissexto ou não?') | |
ano = int(input('Para isso, digite um ano aleatório (4 digitos): ')) | |
print('') | |
if ano % 4 == 0 and ano % 100 != 0 or ano % 400 == 0: | |
print('O ano de {} é um ano bissexto.'.format(ano)) | |
else: |
This file contains 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
#Calculo de passagem por km. Se <= 199 km = R$ 0,50; Se >= 200 km = R$ 0,45 | |
print('=======CÁLCULO DE PASSAGEM RODOVIÁRIA=======') | |
print('') | |
print('Bem-vindo ao nosso sistema de compras de passagem.') | |
km = float(input('Por gentileza, informe a distância do trecho a ser percorrido: ')) | |
p1 = 0.50 | |
p2 = 0.45 | |
print('') | |
if km <= 199: |
This file contains 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 = str(input('Qual é o seu nome? ')).strip().upper() | |
if "F" in nome: | |
print('Eu sabia! Você tem uma personalidade incrível!') | |
print('Legal! Tenha um ótimo dia, {}!'.format(nome)) | |
This file contains 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
tempo = int(input('Quantos anos tem o seu carro? ')) | |
if tempo <= 3: | |
print('Parabéns! O seu carro está novinho em folha!') | |
elif tempo <=6: | |
print('Ehhh, não é novo, mas ainda tem qualidade!') | |
else: | |
print('Xiii...Já não está na hora de trocar por um novo!?') | |
This file contains 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
#Faça um programa que leia uma frase pelo teclado e mostre quantas vezes aparece a letra "A", | |
# em que posição ela aparece a primeira vez e em que posição ela aparece a última vez. | |
frase = str(input('Digite uma frase: ')).strip().upper() | |
print('A letra A aparece {} vezes na frase'.format(frase.count('A'))) | |
print('A letra A aparece pela 1ª vez na posição {}'.format(frase.find('A'))) | |
print('A letra A aparece pela última vez na posição {}'.format(frase.rfind('A'))) |
This file contains 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
number = int(input('Você quer o cálculo de qual número?')) | |
operacao = input('Qual operação você quer fazer?') | |
fator = int(input('Você quer a operação até qual fator?')) | |
print('Aqui está a', operacao, 'do', number,', de 0 a', fator) | |
for (fator) in range(int(fator) + 1): | |
if operacao == '+': | |
operacao = '+' | |
soma = (number + fator) |