I don't know what to do.why it doesn't work?


#1

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


#2

It isn't indented, indentation is part of the language so it needs to be included both when running the code and when showing the code to others.

Aside from that, what do you mean by that it doesn't work? Can you describe that in terms of what it does differently from what you want it to do? The word "work" doesn't carry that information.


#3

How about this?

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

#4

you have a return statement before the if statements. The compiler will "leave the function" once something has been returned.