17. Review: Function


This is my code

def shut_down(s):

if s or "yes":
return "Shutting down"
elif s == "no":
return "Shutdown aborted"
return "sorry"

and it threw the error

File "python", line 3
if s or "yes":
Indentation Error: expected an indented block

> Someone please help me


Instead of "or" it should be == , as it is equal too. Hope this helps!


Please tell me if this helps, as this is my first comment!


sorry but it didn't really help. i still got the same thing

Functions.17: some one plz tell me what I'm doing wrong

well you made two errors, the first was writing:

if s or "yes"

as you want to the function to return "shutting down" when the variable 's' is equal to 'yes'.
However, to solve your error message, you need to add some indents to your code. It should look like:

def shut_down(s)
    if s == "yes":
       return "shutting down"
   elif s == "no":



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