Create an Exercises Directory. Create a directory (or folder) for keeping your various exercise scripts. Be sure it is not in the same directory in which you installed Python.
Use IDLE's Shell Window. Start IDLE. Refer back to the exercises in the section called “Command-Line Interaction”. Run these exercises using IDLE.
Use IDLE's File Window. Start IDLE. Note the version number. Use under the menu to create a simple file. The file should have the following content.
""" My First File """ print __doc__
Save this file in your exercises directory; be sure the name
ends with .py. Run your file with the
menu item in the
menu, usually F5.
Print Script. Create and run Python file with commands like the following examples: print 12345 + 23456; print 98765 - 12345; print 128 * 256; print 22 / 7.
Another Simple Print Script. Create and run a Python file with commands like the
following examples: print "one red", 18.0/38.0;
print "two reds in a row",(18.0/38.0)**2.
Interactive Differences. First, run IDLE (or Python) interactively and enter the
following "commands": copyright,
license, credits. These are
special global objects that print interesting things on the
interactive Python console.
Create a Python file with the three commands, each one on a
separate line: copyright,
license, credits. When you run
this, it doesn't produce any output, nor does it produce an
error.
Now create a Python file with three commands, each on a separate line: print copyright, print license, print credits.
Interestingly, these three global variables have different
behavior when used in a script. This is rare. By default, there are
just three more variables with this kind of behavior:
quit, exit and
help.
Numeric Types. Compare the results of 22/7 and 22.0/7. Explain the differences in the output.