Review: Functions Lesson 17 Syntax error


#1



17: Review Functions Python


File "python", line 4
elif shut_down(s == "no"):
^
SyntaxError: invalid syntax

Oops, try again. 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: invalid syntax (python, line 4)


For it to run


Replace this line with your code. 
def shut_down(s):
    if(shut_down(s) == "yes"):
        return "Shutting Down"
        elif (shut_down(s) == "no"):
            return "Shutting down aborted"
            else:
                return "Sorry"


#2

Recommend go back to the lesson that introduces indentation and review that. As mentioned in an early post today, Python indentation is crucial to the interpreter being able to distinguish blocks. It's not just for pretty looks. Once you complete the review, you will be able to fix this.


#3

Do you know what lesson that would be?


#4

Here is the one in Functions. It mentions,

The body is indented, just like for conditional statements.

Which means it comes up in those modules, as well.


#5

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