Ter

In This Chapter

Jumping in: Starting the Python interpreter

Experimenting with variables and expressions

Defining a function

Running a Python program

Looping and control

Lists and tuples

Dictionaries

Reading and writing files

Loading and using modules

On Windows, you can also bring the interpreter up from Start O Programs O Python 2.0 O Python (command line).

Once you start the interpreter, Python displays something like this:

Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on Win32

Type "copyright", "credits" or "license" for more information. >>>

The interpreter displays the >>> prompt to show that it's ready for you to type in some Python. And so, in the grand tradition of programming books everywhere, we proceed to the "Hello world" example:

>>> print "Hello world!" Hello world!

To exit the interpreter, type the end-of-file character (Ctrl-Z on Windows, or Ctrl-D on Linux) and press Enter.

Note You may prefer to interact with the interpreter in IDLE, the standard Python IDE.

IDLE features syntax coloring, a class browser, and other handy features. See Appendix B for tips on starting and using IDLE.

Was this article helpful?

0 0

Post a comment