Question

I need to write a function in python that will take a user input of cents...

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.

Homework Answers

Answer #1
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)

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I need to write a function in python that will take user input of temperature in...
I need to write a function in python that will take user input of temperature in degrees Celcius and convert it into degrees Fahrenheit. I am familiar with C++ but not python.
Write a program that input some number of cents (see less than 100), and output the...
Write a program that input some number of cents (see less than 100), and output the number of quarters, dimes, nickels and pennies needed to add up to that amount (thinking how a cashier needs to return you back some small changes).
USE PYTHON Please!!! 4.15 LAB: Exact change Write a program with total change amount as an...
USE PYTHON Please!!! 4.15 LAB: Exact change Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1...
6.         Write a single statement that prompts the user to enter their age in years and places...
6.         Write a single statement that prompts the user to enter their age in years and places the integer value in a variable named age. 7.         Can a program place more than one statement on the same program line? 8.         Write a short code segment in Python that prompts the user to enter the number of quarters, dimes, nickels and pennies they have, compute the total value and print that value.
You have a large collection of pennies and wish to change them into dollar bills at...
You have a large collection of pennies and wish to change them into dollar bills at the bank, with quarters, dimes, nickels, and pennies being used for any remainder. Prompt for the number of pennies and produce output as shown below. Write the pseudo code Desk check Modify if necassary Code Compare output Output: How many pennies do you have (must be greater than 100)? [Assume user inputs 641] 641 pennies can be changed at the bank as follows: Dollars:...
PYTHON: Write a function called keepShouting. This function does not need any input parameters. The function...
PYTHON: Write a function called keepShouting. This function does not need any input parameters. The function should simply repeat whatever the user enters but in all capitals! The function should ask the user to enter a phrase. The phrase then should be capitalized and printed to the screen. If the user just hits return (which will produce the empty string) then the program should stop. Hint: Use a while loop and string methods # keepShouting() """ The function call should...
Write a Python program to calculate the area of a circle. The user needs to input...
Write a Python program to calculate the area of a circle. The user needs to input the value of the radius of the circle. area = 3.14 x radius x radius You should use a function named circlearea to perform the calculation 3. Write a Python program to calculate the area of a square. The user needs to input the value of the length of the square. area = len*len You should use a function named squarearea to perform the...
Write a Python program to ask user input of a string, then ask user input of...
Write a Python program to ask user input of a string, then ask user input of what letters they want to remove from the string. User can either put in "odd", "even" or a number "n" that is greater than 2. When user input "odd", it will remove the characters which have odd numbers in the sequence of the string. When user input "even", it will remove the characters which have even numbers in the sequence of the string. When...
Develop an algorithm in Python and write a code that prompts the user to input a...
Develop an algorithm in Python and write a code that prompts the user to input a number and returns the square root of that number.
Q1) Write a program that prompts the user to input an integer that represents cents.The program...
Q1) Write a program that prompts the user to input an integer that represents cents.The program will then calculate the smallest combination of coins that the user has. For example, 27 cents is 1 quarter and 2 pennies. Note : given $bills the change should come has to run from pycharm.