Control flow exercise question

def clinic():
    print "You've just entered the clinic!"
    print "Do you take the door on the left or the right?"
    answer = raw_input("Type left or right and hit 'Enter'.").lower()
    if answer == "left" or answer == "l":
        print "This is the Verbal Abuse Room, you heap of parrot droppings!"
    elif answer == "right" or answer == "r":
        print "Of course this is the Argument Room, I've told you that already!"
        print "You didn't pick left or right! Try again."


For this code given in the exercise, what is the purpose of clinic() given in the last 2 lines?

I know clinic is the name of the function, why do you have to name the function names again in the last 2 lines?


functions only execute when called, so the last line calls the function, otherwise nothing would happen

the function call within the else clause will cause the function to call itself, this way, the user gets another change to enter valid input


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