Question: using python 3 Write a function cad_cashier(price,payment) that takes two real nonnegative numbers with two decimal places as input, where payment>=price and where the second
using python 3
Write a function cad_cashier(price,payment) that takes two real nonnegative numbers with two decimal places as input, where payment>=price and where the second decimal in payment is 0 or 5. They represent a price and payment in Canadian dollars. The function should return a real number with 2 decimal places representing the change the customer should get in Canadian dollars. Recall that in Canada, while the prices are expressed in pennies, the change is based on rounding to the closest 5 cents. See the examples in Section 2 for clarification and examples on how your function must behave
>>> # testing Question 13 cad cashierCie.58, 11) cad_ cashier(98.87, 1ea) 8-4 1.15 4.4 4.45 4.45 cad cashier(10.58,15) cad cashierC1e.55, 15) cad cashierc1o.54, 15) cad cashier(1.52, 15) 4.5 33 cad_cashierC18.50,15) 4.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
