Errors in 17.Review:Function


#1



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


File "python", line 3
if s == "yes":
^
IndentationError: expected an indented block


def shut_down(s):

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


#2

The error says that your if statement needs to be indented.
Indentation is important in Python. Anything nested inside something should be indented.
A general format is

def random_function(x):
    if x == "foo":
        return "foo"
    elif x == "foo foo":
        return "foo foo"
    else:
        return "foo foo foo"

#3

THX!
I have solved it


#4

A post was split to a new topic: 17. function review


#5