-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaula66.py
More file actions
43 lines (33 loc) · 963 Bytes
/
Copy pathaula66.py
File metadata and controls
43 lines (33 loc) · 963 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
36
37
38
39
40
41
42
43
""" Calculadora com while """
while True:
numero_1 = input('Digite um número: ')
numero_2 = input('Digite outro número: ')
operador = input('Digite o operador (+-/*): ')
numeros_validos = None
try:
num_1_float = float(numero_1)
num_2_float = float(numero_2)
numeros_validos = True
except:
numeros_validos = None
if numeros_validos is None:
print('Um ou ambos os Números digitados são inválidos.')
continue
operadores_permitidos = '+-/*'
if operador not in operadores_permitidos:
print('Operador Inválido.')
continue
if len(operador) > 1:
print('Digite apenas operador.')
continue
if operador == '+':
...
elif operador == '-':
...
elif operador == '/':
...
elif operador == '*':
...
sair = input('Quer Sair: [s]im: ').lower().startswith('s')
if sair is True:
break