I was given a prompt that asks to input any amount of money and print how many of each coin is needed for that amount of money. For example, 2.05 would be 8 quarters and 1 nickel. I thought I had it right, but when I input 2.05, it prints 8 quarters and 4 pennies. Here is what I have so far:
cents=float(input("How much change is owed?"))
quarters=cents//.25
round(quarters)
print(quarters, "quarters")
cents=cents%.25
dimes=cents//.10
round(dimes)
print(dimes, "dimes")
cents=cents%.10
nickels=cents//.05
round(nickels)
print(nickels, "nickels")
cents=cents%.05
pennies=cents//.01
round(pennies)
print(pennies, "pennies")
How do I fix it? Also, how would I write a function so that the amount of each coin is written as an integer and not as a float?