Can someone please help me understand what I’ve done wrong here.
def ground_shipping(weight, flat=20):
if(weight <= 2):
return(weight * 1.5 + flat)
elif(weight <= 6):
return(weight * 3 + flat)
elif (weight <= 10):
return(weight * 4 + flat)
return(weight * 4.75 + flat)
premium_ground_shipping = 125
def drone_shipping(weight, flat=0):
if(weight <= 2):
return(weight * 4.5 + flat)
elif(weight <= 6):
return(weight * 9 + flat)
elif (weight <= 10):
return(weight * 12 + flat)
return(weight * 14.25 + flat)
def cheapest_shipping(weight):
ground = ground_shipping(weight)
premium = premium_ground_shipping
drone = drone_shipping
if (ground < drone) and (ground < premium):
method = “standard ground”
cost = ground
elif (drone < ground) and (drone < premium):
method = “drone shipping”
cost = drone
else:
method = “premium_ground_shipping”
cost = premium
print("The cheapest option available is " + cost + “with " + method + " shipping.”)
cheapest_shipping(4.8)
cheapest_shipping(41.5)
This is the error message:
Traceback (most recent call last): File “script.py”, line 39, in <module> cheapest_shipping(4.8) File “script.py”, line 27, in cheapest_shipping if (ground < drone) and (ground < premium): TypeError: unorderable types: float() < function()
Thanks!