Return error in 17. Review: Functions


Your function failed on the message yes. It returned 'yes' when it should have returned 'Shutting down'

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



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"

We don't see where in the instructions it says to write this:

Recall that s is a value, a string, not a function, so don't write it as s(), just s.

It is not necessary to wrap the return values in parens.


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