Learning Resources

The Prompt

The Interpreter Prompt

Start the interpreter on the command line by entering python at the shell prompt.

GNU/Linux and BSD users who have installed Python 3.x alongside Python 2.x may have to start the Python 3.x interpreter by entering python3 at the shell prompt.

For Windows users, you can run the interpreter in the command line if you have set the PATH variable appropriately. In order to open the command line in Windows, open the start menu and click 'Run'. In the dialog box, type 'cmd' and press enter; you now have everything you need to get started with python in the DOS prompt.

Notice that Python gives you the output of the line immediately! What you just entered is a single Python statement. We use print to (unsurprisingly) print any value that you supply to it. Here, we are supplying the text Hello World and this is promptly printed to the screen.

How to Quit the Interpreter Prompt

If you are using IDLE or are using a GNU/Linux or BSD shell, you can exit the interpreter prompt by pressing ctrl-d or entering exit() (note: remember to include the parentheses, '()') followed by the enter key. If you are using the Windows command prompt, press ctrl-z followed by the enter key.