Problem Statement:
The problem of denominations in python is very easy. The user gives us a total amount and we should count the number of currency notes to exchange that total amount. For example: if we are given a total amount of 475 then we should exchange it with 4 notes of 100s, 1 note of the 50s, 1 note of 20s, and 1 note of 5s.
Code for denominations in python:
total_amount = int(input("Enter your total amount: "))
list_of_notes = [1000, 500, 100, 50, 20, 10, 5]
for i in list_of_notes:
number_of_notes = total_amount // i
total_amount %= i
if number_of_notes != 0:
print(f"The number of notes of {i} is {number_of_notes}")
Output:
Also Read:
- Hyphenate Letters in Python
- Earthquake in Python | Easy Calculation
- Striped Rectangle in Python
- Perpendicular Words in Python
- Free shipping in Python
- Raj has ordered two electronic items Python | Assignment Expert
- Team Points in Python
- Ticket selling in Cricket Stadium using Python | Assignment Expert
- Split the sentence in Python
- String Slicing in JavaScript
- First and Last Digits in Python | Assignment Expert
- List Indexing in Python
- Date Format in Python | Assignment Expert
- New Year Countdown in Python
- Add Two Polynomials in Python
- Sum of even numbers in Python | Assignment Expert
- Evens and Odds in Python
- A Game of Letters in Python
- Sum of non-primes in Python
- Smallest Missing Number in Python
- String Rotation in Python
- Secret Message in Python
- Word Mix in Python
- Single Digit Number in Python
- Shift Numbers in Python | Assignment Expert
- Weekend in Python
- Shift Numbers in Python | Assignment Expert
- Temperature Conversion in Python
- Special Characters in Python
- Sum of Prime Numbers in the Input in Python