Game Development Reference
In-Depth Information
To keep the strings separate, put a space at the end of the 'Hello' string, before the
single quote, like this:
>>> 'Hello ' + 'World!'
'Hello World!'
>>>
Strings and integers are different data types . All values have a data type. The data type
of the value 'Hello' is a string. The data type of the value 5 is an integer. The data type
of the data that tells us (and the computer) what kind of data it is.
Writing Programs in IDLE's File Editor
Until now we have been typing instructions one at a time into the interactive shell. When
we write programs though, we type in several instructions and have them run all at once.
Let's write our first program!
The name of the program that provides the interactive shell is called IDLE, the
Interactive DeveLopement Environment. IDLE also has another part called the file editor.
Click on the File menu at the top of the Python Shell window, and select New Window .
A new blank window will appear for us to type our program in. This window is the file
editor .
Figure 3-1: The file editor window.
Hello World!
A tradition for programmers learning a new language is to make their first program
display the text "Hello world!" on the screen. We'll create our own Hello World program
now.
Search WWH ::




Custom Search