Skip to content

Note 02: Variables and Expressions

Variables give names to values. Expressions combine values with operators to produce new results.

Example

distance_miles = 12
speed_mph = 4
hours = distance_miles / speed_mph

print(hours)

Common Operators

Operator Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
// Integer-style floor division
% Remainder
** Exponentiation

Design Tip

Break longer calculations into named steps when the intermediate ideas matter. A readable program is usually easier to debug than a compact one.