Answer to Question #325604 in Python for Kiran

Question #325604

Write a program to accept an integer amount from user and tell minimum number of notes needed for representing that amount.

1
Expert's answer
2022-04-08T03:47:57-0400
banknote =[500,200,100,50,20,10,5,2,1]
result = 0
suma = float(input("Enter the amount you want to withdraw: "))
if suma > 0 and suma % banknote[-1] == 0:
    for i in banknote:
        print ( str(i) + "->" + str(suma//i))
        result += suma//i
        suma = suma%i
    print ("Minimum number banknote = " + str(result))


else:
    print ("Incorrect value")

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