Foundation · 0478 areas 7–8 · 20 suggested minutes
01 · Variables, types and precise algorithms
Learning objective: Explain typed values, assignment and sequence; trace a simple program.
An algorithm is a precise ordered method for solving a task. Decomposition breaks a large problem into smaller steps; abstraction retains the details needed for a particular purpose. A variable is a named place for a value. Assignment replaces its current value: total = total + price first evaluates the right side, then stores the result. This differs from an equation asserting two equal quantities. A dry-run trace records values after each step.
Integers represent whole numbers; real values represent quantities with fractions, subject to representation limits. Strings represent text and Booleans represent true or false. Python can infer types at runtime, whereas examination pseudocode may explicitly declare them. INPUT and OUTPUT describe receiving and presenting data; converting text to an integer can fail if the text is not a valid number. Validate data before relying on it, and do not silently treat invalid input as zero.
A flowchart connects start/end, input/output, processing and decision symbols. Pseudocode expresses the same logic without requiring a particular language. Follow the order, define each variable before using it, and keep the task finite when it is intended to terminate. The examples here use fictional numbers rather than personal information. These are selected IGCSE-style foundations; Python syntax and Cambridge examination notation are related learning tools, not interchangeable official mark schemes.
Worked example · follow the reasoning
Python: price = 12; quantity = 3; total = price * quantity; print(total). The assignments store 12 and 3, multiplication produces 36, and output displays 36. Pseudocode uses total ← price × quantity.
Common misconception
Assignment changes a stored value; it is not the mathematical claim that total equals total plus something forever.
