Skip to content

Instantly share code, notes, and snippets.

@MarketaP
Created January 10, 2019 19:50
Show Gist options
  • Save MarketaP/85bcb71cd1d7541321da20f620242150 to your computer and use it in GitHub Desktop.
Save MarketaP/85bcb71cd1d7541321da20f620242150 to your computer and use it in GitHub Desktop.
#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