I need to write a function in python that will take a user input of cents and tell the user how many quarters nickels, dimes, and pennies it would equate to.
def changeMoney(cents): quarters = cents // 25 cents %= 25 dimes = cents // 10 cents %= 10 nickels = cents // 5 cents %= 5 pennies = cents print("Number of quarters:", quarters) print("Number of dimes:", dimes) print("Number of nickels:", nickels) print("Number of pennies:", pennies) cents = int(input("Enter number of cents: ")) changeMoney(cents)
Get Answers For Free
Most questions answered within 1 hours.