Simple Commands. Enter the following one-line commands to Python:
copyright
license
credits
help
Simple Expressions. Enter one-line commands to Python to compute the following:
12345 + 23456
98765 - 12345
128 * 256
22 / 7
355 / 113
(18-32)*5/9
-10*9/5+32
IDLE Exercises
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 File Window. Start IDLE. Note the version
number. Use New Window under the
File 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
Run Module menu item in the
Run menu, usually F5.
Script Exercises
Simple Script. Create a Python file with the following three commands, each
one on a separate line: copyright, license, credits.
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.
Numeric Types. Compare the results of 22/7 and 22.0/7. Explain the
differences in the output.
Published under the terms of the Open Publication License