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
  else:
    pound = 1.50
  return 20 + (weight * pound)

  print(ground_shipping(2))

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

2 Likes

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!

2 Likes

Didn’t they do it in their return statement?

2 Likes

Doh! yes.
apologies.

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

1 Like