Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created Oct 6, 2020
Embed
What would you like to do?
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