17. Review: Functions syntax


#1



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


It's telling me that elif is invalid syntax.
File "python", line 4
elif shut_down(s): s == "no"
^
SyntaxError: invalid syntax


I expected it to not be invalid syntax.


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


#2

def shut_down(s):
if s == "yes":
return "Shutting down"
elif s == "no":
return "Shutdown aborted"
else:
return "Sorry"
this is what it should look like


#3

Don't forget indentation, and the example given don't help at all!

def shut_down(s):

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

#4

Thank you :slight_smile: The indentation is the only issue with your code. Webrockstar's code was accepted by the interpreter.


#7