Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created May 31, 2020 12:33
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/016a5a1fe61919c9e1b18abbe6760ab6 to your computer and use it in GitHub Desktop.
Save codecademydev/016a5a1fe61919c9e1b18abbe6760ab6 to your computer and use it in GitHub Desktop.
Codecademy export
def ground_shipping_price(weight):
if weight <= 2:
return weight * 1.50 + 20
elif weight <= 6:
return weight * 3.00 + 20
elif weight <= 10:
return weight * 4.00 + 20
else:
return weight * 4.75 + 20
premium_shipping = 125.00
def drone_shipping_price(weight):
if weight <= 2:
return weight * 4.50
elif weight <= 6:
return weight * 9.00
elif weight <= 10:
return weight * 12.00
else:
return weight * 14.25
print(drone_shipping_price(1.5))
def cheapest_option(weight):
ground = ground_shipping_price(weight)
premium = premium_shipping
drone = drone_shipping_price(weight)
if ground < drone and ground < premium:
print("Ground shipping is the better option for you! Your total cost is " + str(ground))
elif drone < ground and drone < premium:
print("Drone shipping is the better option for you! Your total cost is " + str(drone))
else:
print("Premuim ground shipping is the better option for you! Your total cost is " + str(premium))
cheapest_option(4.8)
cheapest_option(41.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment