Review: Functions


#1

def shut_down(s):
return s

if s == "yes":
    return "Shutting down"

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

else:
    return "Sorry"

My error is: Oops, try again. Your function failed on the message yes. It returned 'yes' when it should have returned 'Shutting down'


#2

Hi @rainnano,

What is the purpose of having this statement in the function? ...

    return s

#3

Okay, I thought that was needed. Thank you @appylpye for the help. for others, here is the correct code.

def shut_down(s):

if s == "yes":
    return("Shutting down")

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

else:
    return("Sorry")

#4