Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created Dec 1, 2019
Embed
What would you like to do?
Codecademy export
def ground_shipping(weight):
if weight <= 2:
return (weight*1.50) + 20.00
elif (weight > 2) and (weight <= 6):
return (weight*3.00) + 20.00
elif (weight > 6) and (weight <=10):
return (weight * 4.00) + 20.00
else:
return (weight * 4.75) + 20.00
print(ground_shipping(8.4))
premium_gs= 125.00
def drone_shipping(weight):
if weight <= 2:
return weight*4.50
elif (weight > 2) and (weight <= 6):
return weight*9.00
elif (weight > 6) and (weight <= 10):
return weight*12.00
else:
return weight*14.25
print(drone_shipping(1.5))
def shipping_dealFinder(weight):
cheapest_way =""
if (premium_gs < drone_shipping(weight) and
(premium_gs < ground_shipping(weight)):
cheapest_way = "Premium ground shipping"
return cheapest_way +" "+"which costs"+ " " + str(premium_gs)
elif (drone_shipping(weight) < premium_gs)
and (drone_shipping(weight) < ground_shipping(weight)):
cheapest_way = "Drone shipping"
return cheapest_way+" "+ "which costs"+ " "+ drone_shipping(weight)
else:
cheapest_way = "Ground shipping"
return cheapest_way+ "which costs"+" "+ ground_shipping(weight)
print("The cheapest shipping method for a 4.8 pound package is using"+" "+ str(shipping_dealFinder(4.8)))
print("The cheapest shipping method for a 41.5 pound package is using"+" "+ str(shipping_dealFinder(41.5)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment