User Guide
Table Of Contents
133
Terminal=False
Categories=None
3. On the Application Menu, click File, and then click
Save As.
4. Save the file to your desktop with the extension
.desktop.
If you double-click the icon on the desktop, you should see a
terminal window open and display the text “Hello, World!”
However, the terminal window closes as soon as the program
completes.
While you are developing your programs, it can be useful to
keep the program running (and keep the terminal window open)
until the user presses a key. Add the following command to your
.py file. Put it on a new line underneath print("Hello, World!").
input("Press any key to close this window.")
6.2 Python
In the following sections of this chapter, you will learn about the
features of the Python 3 language.
Adding Comments to Python Programs
As your Python scripts become more complicated, you can put
in explanations of what parts of your code do. This is to help you
in case you need to a change a program that you wrote a long
time ago.
To add a comment to a .py file:
• On a new line, type a # symbol and then any text.
Performing Basic Arithmetic
You have seen the function print() that displays information to
the user. From a Python .py file, you need to use this to show the
result of arithmetic calculations. But from the Python Shell, you
can type the expression and the result is automatically shown.