I’m not sure why my last function is not working? I basically copied what the walk through video did for the last function.
My math is sound on the top 2. I know I’m missing something.
The only time it returns correctly is when the premium is the least expensive.
Please HALP
def ground_shipping(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
# Checking my math
print("$" + str(ground_shipping(10)))
premium_ground = 125
def drone_shipping(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
# Checking my math
print("$" + str(drone_shipping(1.5)))
def best_shipping(weight):
ground = ground_shipping(weight)
drone = drone_shipping(weight)
premium = premium_ground
if ground < drone and ground < premium:
method = "standard ground"
cost = ground
if drone < ground and drone < premium:
method = "drone"
cost = drone
else:
method = "premium ground"
cost = premium
print("The cheapest option available is $%.2f with %s shipping."
% (cost, method))
best_shipping(10)