#17.Review:Functions


#1

def shut_down(s):

if shut_down(s = "yes"):
    return "shutting down"
elif shut_down(s = "no"):
    return "shutdown aborted"
else:
    return "sorry"

What am I doing wrong?


#2

@boardcoder37755,

You have use the comparison operator ==
instead of your assignment operator =

So chang your

s = "yes"

into

s == "yes"


#3

This didn't fix the problem for me! Any other ideas?
here is my code:
def shut_down(s):
if shut_down(s=="yes"):
return "Shutting down"
elif shut_down(s=="no"):
return "Shutdown aborted"
else:
return "Sorry"


#4

@coresurfer21512,

In Python the IF ELIF ELSE statement

if condition:
    #  IF code-block
elif condition:
    # ELIF code-block
else
    #ELSE code-block

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

print shut_down("yes")
print shut_down("no")
print shut_down("xx")

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