Maximum recursion depth exceeded


#1

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

maximum recursion depth exceeded...what is going wrong here?


#2

Having the same issue here. My code looks like this though.

shut_down == s

def shut_down(s):

if s == yes the console says "shutting down"

if shut_down("yes"):
    return "Shutting down"

if s == no the console says shutdown aborted

elif shut_down("no"):
    return "Shutdown aborted"

if anything else gets defined as s the console returns sorry

else:
    return "Sorry"

#3

Yeah, I asked around elsewhere. Apparently the function is trying to call itself. However, it's doing it too many times, and if I remove shut_down() I get a syntax error.


#4

Okay, new problem:
def shut_down(s):
if s % "yes":
return "Shutting down"
elif s % "no":
return "Shutdown aborted"
else:
return "Sorry"
It's now telling me my function should take 1 parameter. WHAT DOES IT MEAN!


#6

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

there should be "==" sign (is equals to) instead of %