17 - Functions:review


#1

I honestly don't know what's wrong with it. Someone please help :cry:

def shut_down(s):

      if (s) == "yes":
            shut_down("Shutting down")

      elif (s) == "no":
            shut_down("Shutdown aborted")

      else:
            shut_down("Sorry")

#2

You called your function inside itself before it's defined. The starred items are wrong.

    def shut_down(s):

        if (s) == "yes":
            *shut_down*("Shutting down")

        elif (s) == "no":
            *shut_down*("Shutdown aborted")

        else:
            *shut_down*("Sorry")

#3

Thank you @cadecodes, I will bear this in mind. In the mean time, you get a free cookie

:cookie:


#4

Thanks man! :wink: I love cookies!


#5

Do you have to add the return function? I'm asking this because I don't know...


#6

Yes, this is proper for the function.


#7

Hey can you please tell me whats wrong with my code

def shut_down(s):
return s

if s == "yes":
return "Shutting down"

elif s == "no" :
return "Shutdown aborted"

else :
return "Sorry"


#9

You return s before the if and elif statements. So instead of going through the if, elif and else statements your function returns s already. Delete the "return s" and it should work.