Question: In this lab you are creating two functions that you will call in a loop in order to print the combination of coins needed to

In this lab you are creating two functions that you will call in a loop in order to print the combination of coins needed to make change for a dollar amount (e.g., $5.75).
Define a function named exact_change (amount)
This function takes a single floating point input parameter that's the total change amount in dollars (2-decimal places, without the dollar sign). If the input has more than 2 values to the right of the decimal, all subsequent digits are truncated (e.g.,5.7589 would become 5.75)
It calculates how to make change using the fewest coins. The coin types are pennies, nickels, dimes, quarters, and dollars.
The function returns a tuple with 5 integer values representing the number of each coin to include (in the following order):
dollars
quarters
dimes
nickels
pennies
Define a function named print_coins(coins, single_label, multi_label)
This function takes the following parameters (in this order):
The number of coins as a non-negative (0 or higher) integer
A string with the label to use if there is only 1 coin
A string with the label to use for multiple coins
If the input parameter is 0 or less, do not generate any output
If the value is 1, print the value followed by the single coin label (the second input parameter)
If the value is greater than 1, print the value followed by the multiple coin label (third input parameter)
This function returns None (it's a void function)
The main program
Write a main program that reads in a comma-separated string of floating-point values.
For each value, print Exact change for $:
NOTE: Print the number as a float with no formatting
If the value input is negative, print Invalid amount
If the number of coins would be 0 for all types of coins, print No change
If the value is positive, call your exact_change () function to get the number of each type of coin to include
For each type of coin, call your print_coins () function
Loop through the input values in the comma-separated string that was the input
Trouble with
In this lab you are creating two functions that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!