 # Sal's shipping

I keep getting (None) for the ‘Cheapest’ function.

``````def ground_ship_cost(weight):
if weight <= 2:
price= 1.5
elif weight > 2 <= 6:
price= 3
elif weight > 6 <= 10:
price= 4
elif weight > 10:
price= 4.75
return (weight*price)+20
print(ground_ship_cost(8.4))

def drone_ship_cost(weight):
if weight <= 2:
price= 4.5
elif weight > 2 <= 6:
price= 9
elif weight > 6 <= 10:
price= 12
elif weight > 10:
price= 14.25
return (weight*price)+0
print(drone_ship_cost(1.5))

def cheapest(weight):

ground= ground_ship_cost(weight)
drone= drone_ship_cost(weight)

if ground < premium and ground < drone:
method= "ground"
cost= ground
else:
method= "drone"
cost= drone
print(cheapest(4.8))
``````

What did you expect to get? And why?

I suppose to get a value from the def cheapest(weight), but some it gives no outcome.
You can find it in python 3, control flow practice.

Good that you know what you want, but what have you done to achieve? I don’t see any code which attempts or complete the task/requirement you are describing.

How do we hand data back to the caller?

Here is what i did so far, which is indicating what is the cheapest value from the if statement, then call the function with 4.8, so it should execute from variables ground, premium and drone.

But the `cheapest` function doesn’t `return` anything to be printed. You do the comparison alright and declare the variable. But that is where it ends

somehow it should return a value, i tried to figure how to make that happen but couldn’t.
there is a video explains it but it seems i did the same as the video implemented. link: https://youtu.be/46_cL0O6xyQ

The video uses a print statement in the body of the function? from 5:00 till 5:50 or something in that order. I can clearly see this in the video I fix it, the none is gone. Still there is no value though.

Can i see how you fixed “it”? It could mean anything here. Please post an updated version of your code

``````def ground_ship_cost(weight):
if weight <= 2:
price= 1.5
elif weight > 2 <= 6:
price= 3
elif weight > 6 <= 10:
price= 4
elif weight > 10:
price= 4.75
return (weight*price)+20
print(ground_ship_cost(8.4))

def drone_ship_cost(weight):
if weight <= 2:
price= 4.5
elif weight > 2 <= 6:
price= 9
elif weight > 6 <= 10:
price= 12
elif weight > 10:
price= 14.25
return (weight*price)+0
print(drone_ship_cost(1.5))

def cheapest(weight):

ground= ground_ship_cost(weight)
drone= drone_ship_cost(weight)

if ground < premium and ground < drone:
method= "ground"
cost= ground
What you did, doesn’t help. You haven’t added the `print()` like in the video, which prints the cheapest shipping method.
the body of your function should have a `print()`. The function returns nothing, so you should print the returned result