Review:Function


#1

I inspected the code a lot of times, but i dont see any mistakes
here is my problem:
Your shut_down function threw the following error: maximum recursion depth exceeded

Here is my code:

def shut_down(s):
    if shut_down(s) == "yes":
        return "Shutting Down";
    elif shutdown() == "No":
        return "Shutdown aborted";
    else:
        return "Sorry"

#2

how do you call the function?


#3

calling a function inside a function can be dangerous. s, the function parameter, will hold the string, you should compare s with yes and no.

Not the function itself, that will not work

And you could add a function call after your function


#4

i crafted a new code , but i got other problem
here is my code :
def shut_down(s):
** return s;**
** if shut_down('Yes'):**
** return "Shutting Down";**
** elif shutdown('No'):**
** return "Shutdown aborted";**
** else:**
** return "Sorry"**
print shut_down('yes');

here is my problem:
Your function failed on the message yes. It returned 'yes' when it should have returned 'Shutting down'


#6

please work on your markup:

As for your error message, the function ends the moment a return keyword is reached

I also said you should compare s (the function parameter) with 'yes':

s == 'yes':

same for no, obviously


#7

Thanks for the help , i really appriciate it , i completed it