Sal's shipping no output

def ground_shipping(weight):
 if  weight <= 2:
     price_per_pound = 1.50
 elif weight <= 6:
     price_per_pound = 3.00
 elif weight <= 10:
     price_per_pound = 4.00
    price_per_pound = 14.25
    return 20 + (price_per_pound * weight)
 print( ground_shipping(8.4))

I was getting a promblem so i watched get unstuck video and i exactly copied the programme then i tried to run it but it is not showing any output. I would be glad if you reply

While we cannot see the format of your code (indentation) one common error is to have that line (the one above) indented. If that is the case, then remove the indentation so the print statement is not inside the function code block.

1 Like

Now also it is not showing any output

It looks like there is still some indentation on the last line. That puts it inside the function, and unreachable after return.

1 Like

It now showning output None and when i move print statement inside it says it doesn’t match outer indentation

The print statement includes a call to the function. It should be in outermost scope. If it is returning None then that means there is something amiss in the if statement, or the return is indented too much and should not be in the if statement.

1 Like

Thanks it really helped a lot :grin: