1000 : 8
500 : 1
100 : 0
50 : 1
20 : 2
5 : 0
1 : 3
how to remove spaces before and after :
denominatio problem
nominals = (1000, 500, 100, 50, 20, 5, 1)
amount = int(input('amount = '))
output = {}
for n in nominals:
output[n] = amount // n
amount %= n
for k, v in output.items():
print(k, v, sep=':')
Comments
Leave a comment