Created
January 10, 2019 19:50
-
-
Save MarketaP/85bcb71cd1d7541321da20f620242150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#variables | |
price = 24.95 | |
discount = 1 - 0.4 | |
number_copies = 60 | |
first_copy = 2 | |
next_copies = 0.80 | |
#functions | |
def discounted(price, discount): | |
'''Calculated discounted price''' | |
val = price * discount | |
return val | |
def total(discounted_function, number_copies, first_copy, next_copies): | |
'''Calculates total price with shipping''' | |
val = discounted_function * number_copies + first_copy + next_copies*(number_copies-1) | |
return val | |
#solution | |
print(total(discounted(price, discount), number_copies, first_copy, next_copies)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment