You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: code/daniel/06_make_change/lab06_make_change.py
+75-11Lines changed: 75 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,79 @@
1
-
importcsv
1
+
# Lab 06: Make Change
2
+
3
+
# Let's convert a dollar amount into a number of coins. The input will be the total amount, the output will be the number of quarters, dimes, nickles, and pennies.
4
+
# Always break the total into the highest coin value first, resulting in the fewest amount of coins. For this, you'll have to use floor division //,
5
+
# which throws away the remainder. 10/3 is 3.333333, 10//3 is 3.
6
+
7
+
# Welcome to the Change Maker 5000 (tm)
8
+
# Enter a dollar amount: 1.36
9
+
# 5 quarters, 1 dime, and 1 penny
10
+
# Would you like make more change? yes
11
+
# Enter a dollar amount: 0.67
12
+
# 2 quarters, 1 dime, 1 nickel, 2 pennies
13
+
# Would you like make more change? no
14
+
# Have a good day!
15
+
16
+
# Version 2 (optional)
17
+
18
+
# Instead of hard-coding the coins, store them in a list of tuples. This way you can make custom coins.
0 commit comments