# FAQ: Learn Python - Conditionals & Control Flow - Go With the Flow

This community-built FAQ covers the “Go With the Flow” exercise in Codecademy’s lessons on Python.

## Join the Discussion. We Want to Hear From You!

Agree with a comment or answer? Like () to up-vote the contribution!

Want to take the conversation in a totally different direction? Join our wider discussions.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

## Other FAQs

• This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
• This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon () in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post ().

2 posts were split to a new topic: Why is `clinic` there twice?

1 Like

In most other languages, calling a function from within itself is considered bad form unless there is something to control the depth of recursion. How is Python different? It seems odd not to teach defensive programming from the offset unless Python has some magic way of dealing with it?

The first line of defense against runaway recursion is stack overflow. Python has built in exceptions to handle this case. `RecursionOverflowError` among them.

Under normal circumstances we would be including a base case to detect when the recursion should cease and the call stack wound down to the final return.

It is to be expected that at some point in the study of iteration we will encounter recursion in a comparative sense. The majority of recursion cases can be done with ordinary loops in considerably less operations and time but we are sure to find certain cases where recursion is the best suited implementation. Don’t ask me to give any examples. Doubtless the lines being drawn to our display are an infinite loop of some sort. That might be one.

This code doesn’t seem to work.

After clicking Run, the button spins like it’s in an infinite loop.

After waiting a while, this is the output:

You’ve just entered the clinic!
Do you take the door on the left or the right?
Type left or right and hit ‘Enter’.Traceback (most recent call last):
File “python”, line 13, in
File “python”, line 4, in clinic
ExecTimeoutException: Program took too long to terminate.

I learned from another thread that you have to actually click on the console itself and then type right and hit enter or left and hit enter.

I had to click on my console several times after hitting “Run” , click the “cursor” area, and then tried to type and it failed first time. Second time, I hit “Run”, then clicked on the console, typed “Right” and got the correct response/answer. I also ran it again for “left” and that worked as well.

Hope this helps you and others who are starting with Python like me!

p.s : I should also mention you will not see the result of you typing out right, left or anything else in the console. You just have to type it out and press enter and hope it works

1 Like

I noticed this in another thread yesterday myself!

Clicking in the console works fine and I can see what I’m typing too.

Thanks!