# Sal's Shipping, There is a None in the Result

Hi guys

i have a problem when running my code, I got the correct answer but there is a None in the display
this is my code, thank you

# function for ground shipping

def ground_shipping (weight, cost= 20 ):

if weight <= 2:

``````return (weight * 1.50) + cost
``````

elif weight >= 2 and weight <= 6 :

``````return (weight * 3.0) + cost
``````

elif weight >= 6 and weight <= 10 :

``````return (weight * 4.0) + cost
``````

return (weight * 4.75) + cost

# function for drone shipping

def drone_shipping (weight, cost = 0):

if weight <= 2:

``````return (weight * 4.50) + cost
``````

elif weight >= 2 and weight <= 6 :

``````return (weight * 9.0) + cost
``````

elif weight >= 6 and weight <= 10 :

``````return (weight * 12.0) + cost
``````

return (weight * 14.25) + cost

def shipping_cost (weight):

ground = ground_shipping (weight)

drone = drone_shipping (weight)

if ground < premium and ground < drone:

``````method = 'standard ground'

cost = ground
``````

``````method = 'premium'

``````

else:

``````method = 'drone'

cost = drone
``````

print (

``````"The Cheapest Option Available is \$%.2f with %s shipping."

% (cost, method)
``````

)

print(drone_shipping(1.5))

print(shipping_cost(4.8))

print(shipping_cost(41.5))

First off, use the “</>” button to format your code. When you do that, the code is much easier to read.

I am still kind of a noob at Python, but I see a logic problem with your code.

In this part, you wrote `if weight <= 2`, but also `elif weight >= 2`. As a result, 2 goes into both of these loops, and that probably causes an error.

According to this logic, fix all the similar problems and see if it works.

Again, I am still a noob so this might not fully fix the problem.

1 Like

I try it but still the output is this

6.75
The Cheapest Option Available is \$34.40 with standard ground shipping.
None
The Cheapest Option Available is \$125.00 with premium shipping.
None

I’m sorry, I really am not sure

1 Like

Or not, since every case has a `return`

That is printing the result of the print statement in your function. Have your function return instead of print…

2 Likes

That okay, thank you for your help

Okay i try to change it to one return in every function

It only needed to be changed in the one above.