Sal's shipping -> not printing with full statement

Hi, my solution works in that it tells the correct method and cost of shipping.

But it doesn’t print the full statement as I want:

def ground_shipping_cost(weight):
if weight > 10:
price_per_pound = 4.75
elif weight >= 6:
price_per_pound = 4
elif weight >= 2:
price_per_pound = 3
price_per_pound = 1.50

return 20 + (weight * price_per_pound)


premium_shipping_cost = 125.00

def drone_shipping_cost(weight):
if weight > 10:
price_per_pound = 14.25
elif weight >= 6:
price_per_pound = 12
elif weight >= 2:
price_per_pound = 9
price_per_pound = 4.5

return price_per_pound * weight


def cheapest_shipping_method(weight):
if ground_shipping_cost(weight) < premium_shipping_cost and ground_shipping_cost(weight) < drone_shipping_cost(weight):
method = “standard ground”
cost = ground_shipping_cost(weight)
return method, cost
elif premium_shipping_cost < drone_shipping_cost(weight):
method = “premium ground”
cost = premium_shipping_cost
return method, cost
method = “drone”
cost = drone_shipping_cost(weight)
return method, cost

print(“The cheapest shipping method is” + method + “at a cost of $” + cost)



Try making that your return line, and remove print.

Hi that didn’t seem to work. It doesn’t seem to recognise method or cost from my earlier inputs.

There is a lot of code there and it is not easy to discern which are code bodies and which lines are in global scope. Check the New User section for advice on how to format code samples in your posts. If you cannot edit your topic opener, then paste the code you have into a new reply.