Question: using python 3 Suppose that a cashier in Canada owes a customer some change and that the cashier only has coins ie. toonies, loonies, quarters,
using python 3
Suppose that a cashier in Canada owes a customer some change and that the cashier only has coins ie. toonies, loonies, quarters, dimes, and nickels. Write a function that determines the minimum number of coins that the cashier can return. In particular, write a function min_CAD_coins(price,payment) that returns five numbers (t,l,q,d,n) that represent the smallest number of coins (toonies, loonies, quarters, dimes, and nickels) that add up to the amount owed to the customer (here price and payment are defined as in the previous question). You program must first call cad_cashier function, from question 13, to determine the amount of change that needs to be returned. Then before doing anything else, you may want to convert this amount entirely to cents (that should be of type int). Once you have the total number of cents here are some hints on how to find the minimum number of coins.
>>> # testing Question 14 >min CAD_coins(10.58,11) >>min CAD_coins(98.87,100) >min CAD_coins(10.58,15) >>min_CAD_coins(10.55,15) >min CAD_coins(10.54,15) >>min_CAD_coins(10.52,15) (2, 0, 2, 0,0) >min CAD_coins(10.50,15) (2, 0, 2, 0, 0) >>>min_CAD_coins(3, 20)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
