The big IF im stuck


#1



5/ exercise 15 what if

Oops, try again. The following exception was raised when calling the_flying_circus(): RuntimeError: maximum recursion depth exceeded


# Make sure that the_flying_circus() returns True
def the_flying_circus():
    if the_flying_circus()>5 and 4<5 :
        print("Hello World")# Start coding here!
        # Don't forget to indent
        # the code inside this block!
    elif the_flying_circus()<5 and (8<9):
        print("heello")
    else:
        print("Bye")
        # Keep going here.
        # You'll want to add the else statement, too!


#2

Hello.
It seems that you wanted to put the the_flying_circus function in conditional statements inside the definition of itself. Edit: I believe it is called "recursion".
Well, you can't do that.

def the_flying_circus():
    if the_flying_circus()>5 and 4<5 :
        print("Hello World")# Start coding here!
        # Don't forget to indent
        # the code inside this block!
    elif the_flying_circus()<5 and (8<9):
        print("heello")
    else:
        print("Bye")
        # Keep going here.
        # You'll want to add the else statement, too!
the_flying_circus()

I've added the_flying_circus() line at the end of your code to check the result. And Python simply doesn't understand what you were asking it to do.

For now, just play with numbers to compare with. Or use True / False.


#3

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