https://www.codecademy.com/courses/learn-python-3/projects/sals-shipping?action=resume_content_item
So I am stuck on the final function. It always comes back as ground shipping. I have seen the video example of how they do it, but we haven’t been taught how to do it the way it is done in the videos. So I want to do it following the same methods we have been taught up to this point.
premium_ground_shipping = 125.00
def ground_shipping(weight):
flat_charge = 20
if weight <= 2.00:
cost = (1.50 * weight) + flat_charge
return cost
elif weight <= 6.0:
cost = (3 * weight) + flat_charge
return cost
elif weight <= 10.0:
cost = (4 * weight) + flat_charge
return cost
elif weight > 10:
cost = (4.75 * 10) + flat_charge
return cost
def drone_shipping(weight):
if weight <= 2.0:
cost = weight * 4.50
return cost
elif weight <= 6.0:
cost = weight * 9
return cost
elif weight <= 10.0:
cost = weight * 12
return cost
elif weight > 10:
cost = weight * 14.25
return cost
def cheapest_shipping(weight):
drone = drone_shipping(weight)
ground = ground_shipping(weight)
premium = premium_ground_shipping
if premium < drone and premium < ground:
return "Premium is the cheapest: $" + str(premium)
elif drone < premium and drone < ground:
return "Drone is the cheapest: $" + str(drone)
elif ground < drone and ground < premium:
return "Gorund is the cheapest: $" + str(ground)
print(cheapest_shipping(4.8))
print(cheapest_shipping(41.5))