Operation Manual
Before you run your program, save it as helloworld.py using the File menu. If you’re using IDLE, the file will be given the
extension .py automatically. If you’re using a text editor, be sure to type .py at the end of the filename (not .txt) when you
save it. This extension indicates that the file contains Python code—although Python is clever enough to run the program even if
it’s saved with a different file extension.
How you run the file will depend on whether you’re using IDLE or a text editor. In IDLE, simply choose Run Module from the
Run menu, or press the F5 key on the keyboard. This will switch IDLE back to the Python shell window and run the program.
You should then see the message Hello, World! appear onscreen in blue (see Figure 11-3). If not, check your syntax—in
particular, check that you have quotation marks at both the beginning and end of the message on the print line.
Figure 11-3: Running helloworld.py in IDLE
If you created the helloworld.py program in a text editor, you’ll need to open a terminal window from the Accessories menu
on the desktop. If you saved the file anywhere except your home directory, you’ll also have to use the cd command to change to
that directory (see Chapter 2, “Linux System Administration”). Once you’re in the right directory, you can run your program by
typing the following:
python helloworld.py
This tells the operating system to run Python and then load the helloworld.py file for execution. Unlike the Python shell in
IDLE, Python will quit when it reaches the end of the file and return you to the terminal. The result, however, is the same: the
message Hello, World! is printed to the standard output (see Figure 11-4).
Figure 11-4: Running helloworld.py at the terminal