Cannot get function with if else statement to work (lesson 17. Review: Functions)

  1. Review: Funtions

I am missing something here but I cannot figure out what. Below see my code for the exercise.

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


Please format your post before posting it as I have done (select code block; press Ctrl+Shift+C) from next time. Thanks! :slightly_smiling:

Why do you have return s in the first line of the method? That would cause the function to stop executing and return whatever string had been passed as an argument. You surely don't want that to happen.

Can you now fix the error?


This is my code .thanks for your comment