# Sal's Shipping Exercise - Can't get final IF statement to work

My code is as follows;

``````def ground_shipping(weight):
flat_charge = 20
if (weight <=2.0):
return 1.50 * weight + flat_charge
elif (weight <= 6.0):
return 3.00 * weight + flat_charge
elif (weight <= 10.0):
return 4.00 * weight + flat_charge
else:
return 4.75 * weight + flat_charge
print(ground_shipping(8.4))

def drone_shipping(weight):
if (weight <=2.0):
return 4.50 * weight
elif (weight <= 6.0):
return 9.00 * weight
elif (weight <= 10.0):
return 12.00 * weight
else:
return 14.25 * weight
print(drone_shipping(1.5))

def statement(weight):
ground = ground_shipping(weight)
drone = drone_shipping(weight)
if (ground < drone and ground < premium):
shipping = "ground shipping"
cost = ground
elif (drone < ground and drone < premium):
shipping = "drone shipping"
cost = drone
else:
print("The cheapest shipping method is " + str(shipping) + " for " + str(cost))

print(statement(4.8))
print(statement(41.5))

``````

The problem is, when I run the final two prints, the second works since the if statement just skips to the else part. The first part (4.8 weight) won’t work and I can’t figure out why. I know it should return ‘ground’, but it’s just returning ‘none’.

the print statement:

``````print("The cheapest shipping method is " + str(shipping) + " for " + str(cost))
``````

is part of the else clause, why?

you always want to print the cost, that is why you set up the variables in the various conditions

Ah, i didn’t even notice it was in the else statement.

Now I’m just trying to figure out these ‘none’ responses.

``````53.6
6.75
The cheapest shipping method is ground shipping for 34.4
None
The cheapest shipping method is premium ground shipping for 125.0
None
``````

Edit: nevermind, im an idiot.