Review: Functions


#1

I've been trying to complete this exercise for the best part of a month now, but I always get the same reference error:

Oops, try again. Your shut_down function threw the following error: maximum recursion depth exceeded in cmp

Here the exercise is:

https://www.codecademy.com/courses/python-beginner-c7VZg/4/1?curriculum_id=4f89dab3d788890003000096

and here my code is:

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

#2

HI is because you are calling the function inside the same function (in some case you can do it but this isn't it) try just to put as condition

if s == "yes":
...

do teh same for the else if statement


#3

Thanks a lot, that worked great!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.