Question: Exercise 2 : Write a program to calculate change from a transaction. Create a variable for the cost of some item and the size of
Exercise : Write a program to calculate change from a transaction.
Create a variable for the cost of some item and the size of the bill a customer pays with. Assign some values of your choice
to your variables.
Find the total change owed the customer by subtracting item cost from amount paid. NOTE: Due to rounding in the
computer, your final result might be off by cent. As a quick fix add to this difference. There are better ways to fix
this, but not with our current material, so we'll go with this.
Determine the exact breakdown of bills andor coins owed the customer using the divmod function. You should
minimize the number of billcoins returned using standard US currency: $$$$$$ and c
Remember that divmod returns two outputs, one from integer division and one from modulo.
Use print function to output the breakdown.
For example, a customer might buy something for $ with a $ bill. They are owed a total of $ in change. This would
be two $ bills, one $ bill, one $ bill, three quarters, and a nickel.
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
