Assignment statements

The general form of an assignment statement:

variable = expression

Example assignment statements:

>>> base = 20
>>> height = 12
>>> area = base * height / 2
>>> area
120.0

The rules for executing an assignment statement:

  1. Evaluate the expression. This produces a memory address.
  2. Store the memory address in the variable.

Variable names

The rules for legal Python names:

  1. Names must start with a letter or _.
  2. Names must contain only letters, digits, and _.

For Python, in most situations, the convention is to use pothole_case (or Snake Case) in Python: lowercase_words_separated_by_underscores