How to Start and Use the Default Development Environment in Python

By Brendan Scott

An integrated development environment is a kind of word processor for coding. Python comes with a code editor called IDLE. The editor has two main parts:

  • The Shell window gives you the Python prompt shown in Figure 1.

  • The Editor window lets you save and run your files.

    Figure 1: What an IDLE shrunken Shell window looks like.

    Figure 1: What an IDLE shrunken Shell window looks like.

Never use a word processor for coding! Don’t cut and paste from your word processor. Characters that work with Python get replaced with heinous ones that Python can’t handle. For example, something like message = ‘Don’t use Word!’ should create a string literal. If you copy and paste it from Word into Python, you get a syntax error on the first single quote. That’s because ‘ isn’t the same thing as ‘. These things — “” — are different from what Python uses: “.

The IDLE environment won’t work if you’re using Python on a tablet. Look at an app store for apps that give you a coding environment on your tablet.

To start IDLE, follow these instructions. If you pinned IDLE (Python GUI) to the top of your Start menu. It should still be up there.

  1. Start IDLE by clicking the Windows Start menu.

    When you start IDLE, you should see the Shell window with the Python interactive prompt. (It’s shown in Figure 1.) Yours may be a bit longer.

    To open the IDLE Shell on Mac: Open a terminal and type IDLE at the prompt. The IDLE Shell window opens.

  2. Type the Hello World! program into the prompt.

    You should get a pleasant surprise like the one in Figure 2.

    Figure 2: Syntax highlights put your code in different colors.

    Figure 2: Syntax highlights put your code in different colors.

IDLE shows you all parts of the program, including Python’s output, in different colors. IDLE gives different colors to keywords (like print), strings (like ‘Hello World!’), and numbers. These color cues can be helpful when you’re programming.

In Figure 3 the closing parenthesis is still green, not black. This means that Python still thinks it’s part of a string literal. You know then that you have to put in a closing quote. What’s more, when you press Enter, IDLE highlights the error.

Figure 3: IDLE highlights your error.

Figure 3: IDLE highlights your error.

In addition to the error notice that you get from the Python interpreter, IDLE gives you visual feedback about where it thinks there’s a problem. Of course, IDLE isn’t always right.