Review function


#1

I put this in:

def shut_down(s):
return s

if s == "yes":
return "shutting down"
elif s == "no":
return "shutdown aborted"
else:
return "Sorry"

and I'm getting the error:

Your code looks a bit off. Feel free to peek back at earlier exercises if you need a refresher! Your code threw the following error: 'return' outside function (python, line 5)


Review : functions
#2

Look the indentation


#3

If you are going to reply to an existing topic, please read the answer in this topic. Because they cover all the problems you have.

@neriyah, the lack of indention is just because no format/markup is used


#5

Try out this code.

Note: Use proper indentation.

def shut_down(s):

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

#6

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