Review: Functions


#1

I am not really sure what's wrong with the code. It keeps telling me invalid syntax with line two.

def shut_down(s):
     if s == "yes"
     return "Shutting Down"

elif:
     s == "no"
     return "Shutdown aborted"

else:
     return "Sorry"

#2

I have indents, they just didn't show up on here.


#3

Could you post a link to the lesson :slight_smile:


#4

The return lines in the if and elif branches need one more indent.


#5

On line 2 you forgot the colon

Your code:
if s == "yes"

should be:
if s == "yes":

Also your elif statement is a bit off

Your code:
elif:
s == "no"

should be:
elif s == "no":

hope this helped:)


#6

Thank you @mtf and @anthonyb19631963, it worked :slight_smile:


#7

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