-1
compra = int(input('Valor da compra: R$'))
valorPago = int(input('Valor pago: R$'))
troco = valorPago - compra
dimDisponivel = [100, 50, 25, 10, 5, 2, 1, 0.50, 0.25, 0.10, 0.05, 0.01]
print(f'Troco: R${troco}\n')
for i in dimDisponivel:
while troco >= i:
print(f'{dimDisponivel.count(i)} de R${i}')
troco -= i
I would like to know how to show only once the amount of a certain repeated banknote, because if the program detects 3 banknotes of 2 reais, it writes 1 of each per line, and I would like to know how to put the 3 notes of 2 in one line.
Although the above questions have titles that do not seem to have anything to do with your case, they brought the same problem. Just adapt the solutions to your case
– hkotsubo