Skip to content

Commit f74bdfd

Browse files
authored
Added casher_job to practice
1 parent 4300b16 commit f74bdfd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Write a function that will take the number of pennies, nickels, dimes,
2+
# quarters, and discount(i.e. 15 for 15% discount). Return the total amount of
3+
# money after discount.
4+
#
5+
# Print what is returned by the function after it is run with 97 pennies,
6+
# 13 nickels, 18 dimes, 54 quarters, and 20% discount.
7+
# Print what is returned by the function after it is run with 32 pennies,
8+
# 19 nickels, 22 dimes, 71 quarters, and 51% discount.
9+
10+
def calc_total(penny, nickel, dime, quarter, discount):
11+
before_discount = 0.01*penny + 0.05*nickel + 0.1*dime + 0.25*quarter
12+
discount_multiplier = 1 - discount*0.01
13+
14+
return round(before_discount* discount_multiplier, 2)
15+
16+
print(calc_total(97, 13, 18, 54, 20))
17+
18+
print(calc_total(32, 19, 22, 71, 51))

0 commit comments

Comments
 (0)