Many of the examples in this handbook use Python's interactive interpreter. If you don't already have one open, you can get an interactive window (a Python Shell) by selecting Python Shell from the Run menu.
A new window containing the following text will appear:
Python 2.2.1 (#1, May 2 2002, 23:54:03) [GCC 2.95.2 19991024 (release)] on sunos5 Type "copyright", "credits" or "license" for more information. IDLE Fork 0.8 -- press F1 for help >>>
The first four lines are version information and can safely be
»> is the Python prompt. It is here that you type
Python code when using it interactively.
The interpreter will highlight your program to aid you: key words it recognizes will be coloured orange while words it does not will be black; quoted text will appear in green and errors in red. This may help you to spot mistakes in your program.
The interpreter will also try to help you write Python in other ways, in particular with laying out your code. As described in Section 3.6.1, code layout is particularly important in Python.
It also has simple history capabilities, allowing you to recall recently typed commands and edit and re-use them. To recall a command, use the arrow keys to move the cursor back up to the line you would like to repeat and press the Return key. That line will then appear at your prompt. You can now edit it if required and execute it as normal.