Answer to Question #219213 in Python for Ravichandrasekhar

Question #219213

Write a program to find the minimum number of notes required for the amount

M. Available note denominations are 500, 50, 10, 1.Input

The first line is a single integer

M.Output

Print

M in denominaitons.Explanation

Given

M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be

500: 3 50: 0 10: 4 1: 3


1
Expert's answer
2021-07-20T17:01:01-0400
nums = (500, 50, 10,1)
M = int(input("Enter amount: "))
output = {}
for i in nums:
	output[i] = M//i
	M %= i
for k, val in output.items():
	print(k, val, 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