def shut_down(s):
if s == “yes”:
return (“Shutting down”)
elif s == “no”:
return (“Shutdown aborted”)
else:
return (“Sorry”)
I have this code and it keeps telling me. Please help.
File “python”, line 4
elif s == “no”:
^
SyntaxError: invalid syntax
rydan
#2
with the right indentation your code works
def shut_down(s):
if s == "yes":
return ("Shutting down")
elif s == "no":
return ("Shutdown aborted")
else:
return ("Sorry")
print (shut_down("yes"))
Python is rather fussy when it comes to indentation so be careful when making if/else statements, functions, loops and so on.