17. Review: Functions


#1



How can I solve this? Thanks in advance!
<img src="//codecademy-discourse.s3.amazonaws.com/original/4X/b/7/d/b7d4e86e6e1785da714d126fcca0d2e588cb8e19.JPG" width="690" height="400">


#2

Huh?


#3

I don't know why the picture is not loading. The code I have written is:

def shut_down(s):
return s

if shut_down(s == "yes"):
return "Shutting down."
elif shut_down(s == "no"):
return "Shutdown aborted."
else:
return "Sorry."

But it says:
File "python", line 5
SyntaxError: 'return' outside function

Where's the mistake I made?


#4

End of execution. Right off the bat. Remove that line and see what happens. Please post the code once you've got that dealt with if you have more issues. Thanks.


#7

This time I used-

def shut_down(s):
if s == "yes":
return "Shutting down."
elif s == "no":
return "Shutdown aborted."
else:
return "Sorry."

And it says-

Oops, try again. Your function failed on the message yes. It returned 'Shutting down.' when it should have returned 'Shutting down'

-__________-


#8

Figured it out. The full-stop at the end of "Shutting down'.'" caused the hassle. Thanks for yout time, mtf! :smiley:


#10