Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created June 23, 2020 11:00
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/f2820f8b90918fea1deb483baa6cdc97 to your computer and use it in GitHub Desktop.
Save codecademydev/f2820f8b90918fea1deb483baa6cdc97 to your computer and use it in GitHub Desktop.
Codecademy export
def cost_ground_shipping(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_ground_shipping(8.4))
premium_shipping_cost=125.00
def cost_drone_shipping(weight):
if weight<=2:
price_per_pound=4.50
elif weight<=6:
price_per_pound=9.00
elif weight <=10:
price_per_pound=12.00
else :
price_per_pound=14.25
return price_per_pound*weight
print(cost_drone_shipping(5))
def cheapest_shipping_method(weight):
if cost_ground_shipping<premium_shipping_cost and cost_ground_shipping<cost_drone_shipping:
return cost_ground_shipping
elif premium_shipping_cost < cost_ground_shipping and premium_shipping_cost <cost_drone_shipping:
return premium_shipping_cost
else:
return cost_drone_shipping
print('the cheapest shipping method is $.2f with %s.')
cheapest_shipping_method(7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment