Skip to main content

Section 2.1 Variables, Expressions and Statements

In the previous chapter, we wrote a program that puts words on the screen. This is a great starting point, but we would like to do more. For instance, we would like the computer to do calculations and manipulate data. In other words, compute things.
In this chapter, you’ll learn about:
  • Values: things that the computer can manipulate, like numbers.
  • Data Types: how values are classified. Numbers, for example, can be classified either as integers (whole numbers) or numbers with decimal places.
  • Variables: names that refer to values. These make our programs more readable and versatile.
  • Operators: Python symbols that stand for operations like addition, subtraction, etc.
  • Expressions: combinations of values, variables, and operators to express some computation.
  • Assignment Statements: how to assign the result of an expression to a variable
  • Input: getting information from the user
These are some of the fundamental building blocks of Python (and almost every other programming language).