0
I’m starting in python watching video lessons on youtube,the following exercise has been passed:
if 10 <= saque <= 600:
notas_cem = saque // 100
saque = saque % 100
I DIDN’T UNDERSTAND THESE PARTS, because the variable "notas_cem" is attributed to the plunder divided by 100? and because the plunder is equal to the rest of this division?
The program should not worry about the amount of notes in the machine.
Example 1: To withdraw the amount of 256 reais, the program provides two 100 banknotes, a 50 banknote, a 5 banknote and a 1 banknote;
Example 2: To withdraw the amount of 399 reais, the program provides three 100 banknotes, a 50 banknote, four 10 banknote, a 5 banknote and four banknotes of 1.
saque = int(input("Digite o valor do saque: "))
if 10 <= saque <= 600:
notas_cem = saque // 100
saque = saque % 100
notas_cinquenta = saque // 50
saque = saque % 50
notas_dez = saque // 10
saque = saque % 10
notas_cinco = saque // 5
saque = saque % 5
notas_um = saque // 1
if notas_cem > 0:
print(notas_cem, "notas de R$ 100")
if notas_cinquenta > 0:
print(notas_cinquenta, "notas de R$ 50")
if notas_dez > 0:
print(notas_dez, "notas de R$ 10")
if notas_cinco > 0:
print(notas_cinco, "notas de R$ 5")
if notas_um > 0:
print(notas_um, "notas de R$ 1")
else:
print("Nao é possivel fazer o saque")