A Byte of Python

Using the interpreter prompt

Start the intepreter on the command line by entering python at the shell prompt. Now enter print 'Hello World' followed by the Enter key. You should see the words Hello World as output.

For Windows users, you can run the interpreter in the command line if you have set the PATH variable appropriately. Alternatively, you can use the IDLE program. IDLE is short for Integrated DeveLopment Environment. Click on Start -> Programs -> Python 2.3 -> IDLE (Python GUI). Linux users can use IDLE too.

Note that the <<< signs are the prompt for entering Python statements.

Example 3.1. Using the python interpreter prompt

$ python
Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
>>> print 'hello world'
hello world


How to quit the Python prompt

To exit the prompt, press Ctrl-d if you are using IDLE or are using a Linux/BSD shell. In case of the Windows command prompt, press Ctrl-z followed by Enter.