Python program to calculate currency notes required to get the amount

Currency Program in Python: In this tutorial, we will learn how to write a Python program to calculate currency notes required to get the amount? By Shivang Yadav Last updated : January 13, 2024

Problem statement

We are given two total amounts. We need to find the number of currency notes required to be given.

Python program to calculate currency notes

notes = (2000,500,200,100,50,20,10,5,2,1)

amount = int(input("Enter Amount to be paid : "))

for C in notes:
    count = amount//C
    print("Note Value : ", C,'\tnumber of notes ',count)
    amount = amount%C

Output

RUN 1:
Enter Amount to be paid : 34521
Note Value :  2000	number of notes  17
Note Value :  500 	number of notes  1
Note Value :  200 	number of notes  0
Note Value :  100 	number of notes  0
Note Value :  50 	number of notes  0
Note Value :  20 	number of notes  1
Note Value :  10 	number of notes  0
Note Value :  5 	number of notes  0
Note Value :  2 	number of notes  0
Note Value :  1 	number of notes  1

RUN 2:
Enter Amount to be paid : 10801
Note Value :  2000      number of notes  5
Note Value :  500       number of notes  1
Note Value :  200       number of notes  1
Note Value :  100       number of notes  1
Note Value :  50        number of notes  0
Note Value :  20        number of notes  0
Note Value :  10        number of notes  0
Note Value :  5         number of notes  0
Note Value :  2         number of notes  0
Note Value :  1         number of notes  1

To understand the above program, you should have the basic knowledge of the following Python topics:

Python Basic Programs »

Related Programs

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.