The Big IF


#1



Hi,
I have written the below code and trying to execute it. But every time is execute i see a run time error.
ERROR: "Oops, try again. The following exception was raised when calling the_flying_circus(): RuntimeError: maximum recursion depth exceeded while calling a Python object"

Can you please let me know what is wrong with my code?


# Make sure that the_flying_circus() returns True
def the_flying_circus():
    answer= raw_input("Enter if you want True or False:")
    if answer == "True" or answer == "1":    # Start coding here!
        print "U have selected True"
    elif answer == "False" or answer == "0":
        print "U have selected False"
    else:
        print " select from the option below"
        the_flying_circus()

the_flying_circus()


#2

the exercise validation can't handle the raw_input (it will input an empty string), so it will always run else, so the function will endlessly call itself (recursion)


#3

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