Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to create a money counter [ PYTHON ]
ChristianDowell

Tired of counting all of your dollars, quarters, dimes, nickels and pennies? Well you came to the right place! So sit back and relax for this tutorial on how to create a money counter!

first, we need to ask for the total amount of money is, this will be important for when we split the money...
Money = float(input('Enter The Amount Of Money: '))

next, we need to multiply the amount by 100.
`money *= 100

then, we split the money into dollars and store it in a variable and divide by 100.
Dollars = int(Money/100)

and we mod money by 100.
Money %= 100

next, we split the money into Quarters and store it in a variable and divide by 25.
Quarters = int(Money/25)

and we mod by 25.
Money %= 25

then, we split the money into Dimes and store it in a variable and divide by 10.
Dimes = int(Money/10)

and we mod by 10.
Money %= 10

then, we split the money into Nickels and store it in a variable and divide by 5.
Nickels = int(Money/5)

and we mod by 5.
Money %= 5

then, we split the money into Pennies and store it in a variable and divide by 1.
`Pennies = int(Money/1)

last, we print the money.
print('Dollars: ' + str(Dollars)) print('Quarters: ' + str(Quarters)) print('Dimes: ' + str(Dimes)) print ('Nickels: ' + str(nickels)) print ('Pennies: ' + str(pennies))

#And That's the end folks! See you next time!

Voters
ChristianDowell