Skip to content

Commit e640280

Browse files
committed
Fix code style issues with Black
1 parent f74bdfd commit e640280

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

2_intermediate/chapter11/solutions/cashier_job.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Write a function that will take the number of pennies, nickels, dimes,
22
# quarters, and discount(i.e. 15 for 15% discount). Return the total amount of
3-
# money after discount.
3+
# money after discount.
44
#
55
# Print what is returned by the function after it is run with 97 pennies,
66
# 13 nickels, 18 dimes, 54 quarters, and 20% discount.
77
# Print what is returned by the function after it is run with 32 pennies,
88
# 19 nickels, 22 dimes, 71 quarters, and 51% discount.
99

10+
1011
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
12+
before_discount = (
13+
0.01 * penny + 0.05 * nickel + 0.1 * dime + 0.25 * quarter
14+
)
15+
discount_multiplier = 1 - discount * 0.01
16+
17+
return round(before_discount * discount_multiplier, 2)
1318

14-
return round(before_discount* discount_multiplier, 2)
1519

1620
print(calc_total(97, 13, 18, 54, 20))
1721

0 commit comments

Comments
 (0)