I got stuck at "review:functions"


Replace this line with your code.

First, def a function, shut_down, that takes one argument s. Don't forget the parentheses or the colon!
Then, if the shut_down function receives an s equal to "yes", it should return "Shutting down"
Alternatively, elif s is equal to "no", then the function should return "Shutdown aborted".
Finally, if shut_down gets anything other than those inputs, the function should return "Sorry"

def shut_down(s):

if shut_down("yes"):
    return shut_down("Shutting down")
elif Shut_down("no"):
    return shut_down("shutdown aborted")
    return "Sorry"


me too, I am thinking that as the reference suggested, we might design three functions to clarify what yes or no means here, but I don't know how to set it~:sweat:


my coding is:

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


This is against community guidelines. If you see that you cannot help the user by leading him in the right direction, it helps in no way to just drop your code and leave.


Don't be so literal,

Just check if your argument is equal to the string.

def shutDown(argument):
    if argument == "yes":
        #do something
    elif argument == "no":
        #do something else
        #fallback to this


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