Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created November 7, 2018 18:47
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/117413256b7c0d357a78ee4728697dd8 to your computer and use it in GitHub Desktop.
Save codecademydev/117413256b7c0d357a78ee4728697dd8 to your computer and use it in GitHub Desktop.
Codecademy export
def ground_shipping(weight):
if weight <=2:
return (weight * 1.5) + 20
elif weight > 2 and weight <= 6:
return (weight*3) +20
elif weight > 6 and weight <= 10:
return (weight * 4)
else:
return (weight *4.75) + 20
price_ground = ground_shipping
price_premium_ground = 125
def drone_shipping(weight):
if weight <=2:
return (weight * 4.5)
elif weight > 2 and weight <= 6:
return (weight * 9)
elif weight > 6 and weight <= 10:
return (weight * 12)
else:
return (weight * 14.25)
price_drone = drone_shipping
def cheapest_shipping_price(weight):
if price_ground(weight) < price_drone(weight) and price_ground(weight) < price_premium_ground:
return (str(price_ground) + "sending it by ground is the cheapest method")
if price_drone(weight) < price_ground(weight) and price_drone(weight) < price_premium_ground:
return (str(price_drone) + "sending it by drone is the cheapest sending method")
else:
return (str(price_premium_ground) + "sending it by premium is the cheapest method")
print(cheapest_shipping_price(4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment