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:
- Evaluate the expression. This produces a memory address.
- Store the memory address in the variable.
Variable names
The rules for legal Python names:
- Names must start with a letter or _
- Names must contain only letters, digits, and _
- For Python, in most situations, the convention is to use snakecase (AKA potholecase).