Python syntax

Hey guys, I have one question about mine code. Honestly I do not get what is wrong with code below. I do not get any error. I get just pitch black screen when I am running the function and looking for the output. Do you have an idea what could be wrong with my code?

def ground_shipping(weight): 
  if weight > 10: 
    pound = 4.75 
  elif weight > 6:
    pound = 4.00
  elif weight > 2:
    pound = 3.00
    pound = 1.50
  return 20 + (weight * pound)


This code could work. Also, check the indentation of the print statement. Right now, it is inside the function.


Have a look at your print function indentation. You wrote it inside a control flow suite. If you amend it, number 23 will be printed as your function output. Happy coding!

Yeah my man. :sweat_smile: This was the catch. I completely forgot to check this. My bad. But thank you for your answer. It is now propertly working.

Usually I do not like to do things exactely how someone tells me to do. So I did check solution and it was the same thing but in different kind of code. So just wanted to know why mine did not work. I get it now.

Thank you all and have a great day!


Didn’t they do it in their return statement?


Doh! yes.

clearly it’s time for me to log off. :slight_smile:

1 Like