-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwhile.py
More file actions
31 lines (25 loc) · 870 Bytes
/
while.py
File metadata and controls
31 lines (25 loc) · 870 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
import sys
opcao = -1
saldo = 25000.00
while opcao != 0 and opcao != 4:
print("Informe uma opção: \n [1] Sacar \n [2] Extrato \n [3] Depositar \n [4] Sair \n")
opcao = int(input())
if opcao == 1:
saque = float(input("Informe o valor do saque: "))
if saldo >= saque:
saldo -= saque
print("Saque efetuado com sucesso!")
print("Saldo atual: R$ %.2f" % saldo)
else:
print("Saldo insuficiente!")
elif opcao == 2:
print("Extrato: R$ %.2f" % saldo)
elif opcao == 3:
deposito = float(input("Informe o valor do depósito: "))
saldo += deposito
print("Depósito efetuado com sucesso!")
print("Saldo atual: R$ %.2f" % saldo)
elif opcao == 4:
print("Sistema encerrado!")
else:
sys.exit("Opção inválida")