Exercise 17 Review Functions



My code if not working. Getting alot of syntax errors but also "outside of function" messages.

Replace this line with your code. 
def shut_down(s):
    return s
    if shut_down(s):
    s = 'yes'
    return "Shutting down"
    elif shut_down(s):
    s = 'no'    
    return "Shutdown aborted"
    s != 'yes' or 'no'
    return "Sorry"


Did you write this from scratch? What part of the insructions do you not understand?


here are the instructions I was trying to follow:

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"



if s == "yes":


if s == "no"

Be sure not to return unless directed to in the if statement. Do no return s.


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