The big if


#1



I'm stuck on "The big if" and I don't know what to do. I've checked the other topics, but they don't seem to help (sorry!).


Anyway, it says that "the following exception was raised when calling the_flying_circus(): RuntimeError: maximum recursion depth exceeded" and I have no idea what a RuntimeError is and why its maximum recursion depth exceeded.


I expect it to work the way that it should, and I think that the task was worded in a challenging way.


def the_flying_circus():
    if the_flying_circus() == 100:
        print "It is flying!"
        
    elif the_flying_circus() < 10 and 1:
        print "We are getting there"
    
    else:
        return True


#2

I've been running into this topic a lot, let me tell you! You are calling the function inside of the function:

which is causing recursion and a type of "infinite loop" but not exactly.
What you need, is to declare two variables inside of, (or outside of), the_flying_circus and set them both equal to "yes", a string.
You need an if, elif, and else statement. The if statement will test if your first variable equals yes AND if the second variable equals yes, and return true if it does. The elif statement will check if one of the variables equals "no", and return false if it does. Lastly, the else statement will just return false.
I really hope this helps, if you have any other questions, let me know. :slight_smile:


#3

So, I deleted the unnnecessary the_flying_circus() , played around with the code and it worked. Thanks


#4

No problem! Glad it works!


#5

u must delete () from your code

if the_flying_circus == 100:
print "It is flying!"

elif the_flying_circus < 10 and 1:
    print "We are getting there"

else:
    return True

This is True


#6

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