Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created October 6, 2020 13:30
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/27202881c697c825dc09c69589aeb18c to your computer and use it in GitHub Desktop.
Save codecademydev/27202881c697c825dc09c69589aeb18c to your computer and use it in GitHub Desktop.
Codecademy export
def shipping_charges(weight):
premium_shipping_charges = 125.00
if weight > 10.0:
ground_shipping_charges = 4.75*weight + 20.00
drone_shipping_charges = 14.25*weight
elif weight > 6.0:
ground_shipping_charges = 4.00*weight +20.00
drone_shipping_charges = 12.00*weight
elif weight > 2.0:
ground_shipping_charges = 3.00*weight +20.00
drone_shipping_charges = 9.00*weight
else:
ground_shipping_charges = 1.5*weight + 20.00
drone_shipping_charges = 4.5*weight
if ground_shipping_charges <= premium_shipping_charges and ground_shipping_charges <= drone_shipping_charges :
print("The cheapest shipping is ground shipping and the cost is " + str(ground_shipping_charges) +" dollars.")
elif drone_shipping_charges <= ground_shipping_charges and drone_shipping_charges<= premium_shipping_charges:
print("The cheapest shipping is drone shipping and the cost is " + str(drone_shipping_charges) +" dollars.")
else:
print("The cheapest shipping is premium shipping and the cost is " + str(premium_shipping_charges) +" dollars.")
print(shipping_charges(6.9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment