Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created April 3, 2020 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/849433346a0c62fd4ef60e319dddf61c to your computer and use it in GitHub Desktop.
Save codecademydev/849433346a0c62fd4ef60e319dddf61c to your computer and use it in GitHub Desktop.
Codecademy export
def cost_of_ground(weight):
if weight <= 2:
price_per_pound = 1.50
elif weight <= 6:
price_per_pound = 3.00
elif weight <= 10:
price_per_pound = 4.00
else:
price_per_pound = 4.75
return 20 + (price_per_pound * weight)
print(cost_of_ground(8.4))
price_of_premium_ground = 125.00
def cost_of_drone(weight):
if weight <= 2:
price_per_pound = 4.5
elif weight <= 6:
price_per_pound = 9.00
elif weight <= 10:
price_per_pound = 12
else:
price_per_pound = 14.25
return weight * price_per_pound
print(cost_of_drone(1.5))
def cheapest_shipping(weight):
print("The cheapest option available is %.2f with $s shipping.")
$(cost, method)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment