-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEX059.py
More file actions
31 lines (28 loc) · 933 Bytes
/
EX059.py
File metadata and controls
31 lines (28 loc) · 933 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
from time import sleep
num1 = int(input("Digite o 1° numero: "))
num2 = int(input("Digite o 2° numero: "))
s = '-'*20
print(s)
sleep(1)
while True:
print(" -> Selecione uma das opções abaixo")
print(" [ 1 ] somar\n [ 2 ] multiplicar\n [ 3 ] maior\n [ 4 ] novos números\n [ 5 ] sair do programa")
resp = str(input(" >> Digite a opção: "))
while resp not in '12345':
resp = str(input("Resposta errada tente novamente: "))
if resp == "1":
r = num1 + num2
if resp == "2":
r = num1 * num2
if resp == "3":
r = f"O menor é {sorted([num1, num2])[0]}, e o maior é {sorted([num1, num2])[1]}"
if resp == "4":
num1 = int(input("Digite o 1° numero: "))
num2 = int(input("Digite o 2° numero: "))
sleep(1)
if resp == "5":
print("Fim")
break
if resp in "123":
print(f"{s}\nA resposta é: {r}\n{s}")
sleep(1)