 # Sal's Shipping

Hello everyone!
When I try to execute the code I got the following:
File “script.py”, line 30, in cheapest_shipping elif premium_cost < ground_cost (weight) and premium_cost < drone_cost (weight): TypeError: unorderable types: int() < tuple()
The code is following:

``````def ground_cost (weight):
if weight <=2:
ground_cost = weight*1.5+20
elif weight <=6:
ground_cost = weight*3+20
elif weight <=10:
ground_cost = weight*4+20
else:
ground_cost = weight*4.75+20
return ground_cost

def drone_cost (weight):
if weight <=2:
drone_cost = weight*4.5
elif weight <=6:
drone_cost = weight*9
elif weight <=10:
drone_cost = weight*12
else:
drone_cost = weight*14,25
return drone_cost

def cheapest_shipping (weight):

if ground_cost(weight) < premium_cost and ground_cost(weight) < drone_cost (weight):
return "The most optimal is ground shipping method and will cost \$ " + str(ground_cost (weight))
return "The most optimal is premium shipping method and will cost \$ " + str(premium_cost)
else:
return "The most optimal is drone shipping method and will cost \$ " + str(drone_cost (weight))

print(cheapest_shipping(41.8))

``````
1 Like

Due to the comma, this assigns a `tuple` to `drone_cost`:

``````    drone_cost = weight*14,25
``````

While it is permissible to use the same name for a local variable as the name of a function that contains that variable, it is not a good idea to do so. You have variables named `ground_cost` and `drone_cost` within the functions of the same names.

3 Likes

Thanks a lot!
That Syntaxis kills me sometimes)

1 Like