Answer to Question #267767 in Python for Knight

Question #267767

given an amount write a program in python to find a minimum number of currency notes of different denominations that sum to the given amount. Available note denominations are 1000, 500, 100, 50, 20, 5, 1.

1
Expert's answer
2021-11-17T12:00:49-0500
# you can add amounts to  find a minimum number of currency
numbers = (1000, 500, 100, 50, 20, 5, 1)
amount = int(input('amount = '))
output = {}
for n in numbers:
    output[n] = amount // n
    amount %= n
for x, y in output.items():
    print(x, y, sep=':')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS