-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcondicionais.py
More file actions
35 lines (31 loc) · 993 Bytes
/
Copy pathcondicionais.py
File metadata and controls
35 lines (31 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Condicionais
# if, elif, else
# Exemplo 1
trabalho_terminado = True
if trabalho_terminado == True:
print('Vamos sair hoje à noite')
else:
print('Estou ocupada ainda, desculpe')
# Exemplo 2
estou_livre = False
if estou_livre == True:
print('Ok, posso te ajudar com a mudança')
else:
print('Peça ao meu irmão para carregar as caixas')
# Exemplo 3
numero_de_atrasos = 2
if numero_de_atrasos >= 3:
print('Você está suspenso')
elif numero_de_atrasos == 1:
print('Mais 2 faltas e você será suspenso')
elif numero_de_atrasos == 2:
print('Mais 1 falta e você será suspenso')
else:
print('Pode se juntar à turma')
# Problema Real - Encontrar o maior entre 2 números:
primeiro_valor = input('Digite o 1º valor: ')
segundo_valor = input('Digite o 2º valor: ')
if int(primeiro_valor) > int(segundo_valor):
print('O primeiro valor é maior que o segundo')
else:
print('O segundo valor é maior que o primeiro')