Funky function


#1

def shut_down(s):
if shut_down(s) == "yes":
return "Shutting Down"

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

  return "Sorry"

can someone please unfunk my function??


I don't know what I'm doing wrong
#2

Hi @milozovic ,

Your function is funky because it calls itself here ...

if shut_down(s) == "yes":

It should be ...

if s == "yes":

Functions can call themselves, but that should not be done for this exercise.

Also make sure that the characters in your returned strings are exactly the same as what is specified in the instructions. You have ...

return "Shutting Down"

... but the instructions ask for ...

return "Shutting down"

#3

Hey thanks man, I am changing that right now sorry for late reply it was confusing me and I will remember this

Milosovic


#4

Another questions, I am wondering if the conditional "if" should be used on the last line of code before "shut_down" to complete the function? The thing isn't even working for some reason.

Thanks!

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

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

shut_down == "maybe":
    return "Sorry"

#5

@milozovic ,

The function should end with an else block, so no condition should be specified there. It should look like this:

else:
    return "Sorry"