3. Writing Programs

Up to now, we’ve been writing single Python statements and running them at the interactive command line. While that’s useful for learning about Python functions, it quickly becomes tiresome when you need to write many lines of Python code.

Thus we turn to writing programs (also known as scripts). Programs are just text files containing a collection of Python commands. When you run (or execute) a program, Python performs each statement in the file one after the other.

In this chapter, we’ll learn how to write and run programs in IDLE and from the command line. ...

Get Python: Visual QuickStart Guide, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.