Review: functions


this is my code:

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

what is wrong


Yes isn't defined.

No isn't defined.

Missing end quote.


just like cadecodes said. What you are doing by that is calling a variable that isnt defined. Also, you are missing "" and : colon goes after every if, elif, and else statements. Try adding this....

if s == "yes":

and repeat with the other lines.


oh thanks but im off that one now should have posted that earlier sorry


here is correct way to declare this function
def shut_down(s):
if s == 'Yes':
return s ,'shutting down'
elif s == 'no':
return s, 'aborted'
return s, 'sorry'


Why is this answer not passing?

s = ""

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

The answer that does pass seems a bit strange to me.

Also, would s = "" be better off inside the function as to eliminate global variables? Is that a python thing?