1. Home
  2. Computing & Technology
  3. Python

How a Computer Reads a Program

From Al Lukaszewski, for About.com

6 of 8

Three Statements - Part 1

There are three kinds of statements in programming: assignment, control, and operation. I shall discuss each of them in greater depth in the respective tutorials on Python. In the next couple of pages, however, I will discuss their basic characteristics.

Assignment statements are perhaps the simplest of the three. In assignment, the value on the right side of the equal sign ('=') is assigned to a variable name on the left. The more common way of describing the statement "x = 25" is to say that 'x equals 25'. As long as x is equivalent to '25', one may refer to the variable 'x' instead of '25' wherever needed. However, one must be careful. If a program is dependent upon x being '25' and x is later assigned a new value, perhaps '26', then every calculation that relies upon x being equivalent to '25' will change, sometimes with unpredictable results.

Explore Python
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Beginning Python
  5. Python Programming - Before Programming Python - Statements and Assignments - Three Statements - Part 1

©2009 About.com, a part of The New York Times Company.

All rights reserved.