O'Reilly logo

Beginning Python: From Novice to Professional, 3rd Edition by Magnus Lie Hetland

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

The Short Version

This is a minimal introduction to Python, based on my web tutorial, “Instant Python.” It targets programmers who already know a language or two but who want to get up to speed with Python. For information on downloading and executing the Python interpreter, see Chapter 1 .

The Basics

To get a basic feel for the Python language, think of it as pseudocode, because that’s pretty close to the truth. Variables don’t have types, so you don’t need to declare them. They appear when you assign to them and disappear when you don’t use them anymore. Assignment is done with the = operator, like this:

x = 42

Note that equality is tested by the == operator . You can assign several variables at once, like this:

x,y,z = 1,2,3first, second ...

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