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 eg $
Define a function named exactchange amount
This function takes a single floating point input parameter that's the total change amount in dollars decimal places, without the dollar sign If the input has more than values to the right of the decimal, all subsequent digits are truncated eg would become
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 integer values representing the number of each coin to include in the following order:
dollars
quarters
dimes
nickels
pennies
Define a function named printcoinscoins singlelabel, multilabel
This function takes the following parameters in this order:
The number of coins as a nonnegative or higher integer
A string with the label to use if there is only coin
A string with the label to use for multiple coins
If the input parameter is or less, do not generate any output
If the value is print the value followed by the single coin label the second input parameter
If the value is greater than print the value followed by the multiple coin label third input parameter
This function returns None its a void function
The main program
Write a main program that reads in a commaseparated string of floatingpoint 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 for all types of coins, print No change
If the value is positive, call your exactchange function to get the number of each type of coin to include
For each type of coin, call your printcoins function
Loop through the input values in the commaseparated string that was the input
Trouble with
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
