Review: Functions


#1



https://www.codecademy.com/en/courses/python-beginner-c7VZg/4/1?curriculum_id=4f89dab3d788890003000096#


So this is my code:

def shut_down(s):
if s == "yes":
return "Shutting down"
elif s == "no":
return "Shutdown aborted"
else:
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.


#2

As the error message states, indentation problem.

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

Fill in the missing bits.


#3

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


#4

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


#5

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