Review: Functions


So this is my code:

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

And this is the error im getting:

File "python", line 3
return "Shutting down"
IndentationError: expected an indented block

What should I fix?

Replace this line with your code.


As the error message states, indentation problem.

def ...:
    if ...:
        return ...
    elif ...:
        return ...
        return ...

Fill in the missing bits.


This is what I have done in the previews code, I have put the ":" in the same way you have placed them above :confused:


We cannot see the indentation in your code without sample formatting. Is your indentation consistent and correct?


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