Game Development Reference
In-Depth Information
Saving Your Program
Once you've
entered your
source code, save
it so that you
won't have to
retype it each
time we start
IDLE. To do so,
choose the File
menu at the top of
the File Editor
window, and then
click on Save As .
The Save As
window should
open. Enter
hello.py in the
File Name box
then press Save .
(See Figure 3-4.)
Figure 3-4: Saving the program.
You should save your programs every once in a while as you type them. That way, if
the computer crashes or you accidentally exit from IDLE, only the typing you've done
since your last save will be lost. Press Ctrl-S to save your file quickly, without using the
mouse at all.
A video tutorial of how to use the file editor is available from this topic's website at
http://inventwithpython.com/videos/.
If you get an error that looks like this:
Hello world!
What is your name?
Albert
Traceback (most recent call last):
File "C:/Python26/test1.py", line 4, in <module>
myName = input()
File "<string>", line 1, in <module>
NameError: name 'Albert' is not defined
...then this means you are running the program with Python 2, instead of Python 3. You
can either install Python 3, or convert the source code in this topic to Python 2. Appendix A
Search WWH ::




Custom Search