Public Group

# Using the Python Interpreter

This topic is 4772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have several questions about using Python in interactive mode (from the shell). When one is writing code inside a block (in other words, the prompt is displayed as "..." instead of ">>>"), Python does not immediately show the output of your statements. I was hoping that it would compile what I typed and show me the output at least for the first iteration. The reason is that my last program was essentially contained within a giant loop. As such, I saw no advantage to using the interpreter. Another question about loops: as mentioned, my last loop was quite complex, since most of the logic of the program was inside of it. Let's say I make a typo in the second-to-last line. What Python does for you is report the error, and return back to the primary prompt (>>>). Uh-oh... does that mean that everything I typed in the loop so far is discarded and I have to start it over again? Is there a way to just return to where you were before you made the mistake and take over from there? Finally, let's say that I wanted everything I typed in the prompt to be exported to a .py script (perhaps the program did not turn out to be as discardable as I expected). Here's what the Python tutorials say on the matter:
Quote:

• 16
• 31
• 9
• 16
• 22