Review: Functions


I get an error saying "File “python”, line 4
SyntaxError: ‘return’ outside function"
I don’t know why I get this error as my indentation and spacing seems correct? What am I missing here?

def shut_down(s):
return s
if s == “yes”:
return (“Shutting down”)
elif s == “no”:
return (“Shutdown aborted”)
return (“Sorry”)


Btw, how do I link my code, so the prober indentation is applied to the post? It seems that my code is not indented at all


Fixed it. It seems that I forgot to indent my if statement.


for next time, use format:

so the indent shows up, so we can help you with this kind of issue, do you understand it now?


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.