Assignment 8 — multi-input problem solving
Due Time: Friday, September 11
Program break_the_bank.py
- With a single prompt, it gets from the user four values in the following order: number of quarters, dimes, nickels, and pennies. Computes and displays how much the coinage is worth.
- Two different possible runs
Number of quarters, dimes, nickels, and pennies: 27 14 28 18
Coinage
27 quarters
14 dimes
28 nickels
18 pennies
are worth 9.73 dollars
Number of quarters, dimes, nickels, and pennies: 1 2 3 4
Coinage
1 quarters
2 dimes
3 nickels
4 pennies
are worth 0.6400000000000001 dollars
FIP
- Recommend that you avoid the ugliness of the last run and use the built-in function
round()
. Functionround()
can take one or two arguments. The first argument is the value to be rounded, the second optional value is the wanted number of places after the decimal. When a second value is not supplied, it rounds to an integer.
© 2020 Jim Cohoon | Resources from previous semesters are available. |