Skip to content

Commit 5c42d27

Browse files
committed
novo
1 parent 7efa207 commit 5c42d27

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ex071.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
11
# 071: Crie um programa que simule o funcionamento de um caixa eletrônico. No início, pergunte ao usuário qual
22
# será o valor a ser sacado (número inteiro) e o programa vai informar quantas cédulas de cada valor serão entregues.
33
# OBS: considere que o caixa possui cédulas de R$50, R$20, R$10 e R$1
4+
valor = int(input('Qual valor você deseja sacar? R$'))
5+
total = valor
6+
nota = 50
7+
total_nota = 0
8+
while True:
9+
if total >= nota:
10+
total -= nota
11+
total_nota += 1
12+
else:
13+
if total_nota > 0:
14+
print(f'Total de {total_nota} cédulas de R${nota}.')
15+
if nota == 50:
16+
nota = 20
17+
elif nota == 20:
18+
nota = 10
19+
elif nota == 10:
20+
nota = 1
21+
total_nota = 0
22+
if total == 0:
23+
break

0 commit comments

Comments
 (0)