Exercise 17 Review Functions


#1



https://www.codecademy.com/courses/python-beginner-c7VZg/4/1?curriculum_id=4f89dab3d788890003000096


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"
    
    else:
    s != 'yes' or 'no'
    return "Sorry"


#2

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


#3

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"


#4

So,

if s == "yes":

So,

if s == "no"

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


#5

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