O'Reilly logo

Python: Visual QuickStart Guide, Second Edition by Toby Donaldson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 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 solve problems that require 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. We’ll see how to get keyboard input from the user and print strings to the screen.

This is just the first step in writing Python programs. In ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required