Modelling the real world
Weather forecasts, games and traffic systems all use computer models. A model is an abstraction: it keeps only the parts of the real world that matter.
State and behaviour
It also needs behaviour: the rules for how the state changes.
In a program, variables and lists hold the state; selection and loops carry out the rules.
Example: UK traffic lights
states = ["red", "red and amber", "green", "amber"]
now = 2
now = (now + 1) % 4
print(states[now])
now = 2 means green. Adding 1 and using % 4 (remainder) moves on, wrapping back to 0 after 3.
Output: amber
Example: a heating system
temp = 18
if temp < target:
heating = "on"
else:
heating = "off"
print(heating)
Output: on
The state is the temperature and target; the rule is: heat if colder than the target.
Evaluate a model by comparing it with real life. Did it leave out something important, such as an open window?
In the traffic light model, what is shown after amber (now = 3)?
- now = (3 + 1) % 4 = 0.
- states[0] is red.
Answer: red
A model is an abstraction of a real system. State is the data describing it now; behaviour is the rules for how it changes. Evaluate a model by checking it against reality.
- AND
- A Boolean operator that gives True (1) only when both inputs are True.
- Model
- A program or simulation that represents a real-world system, keeping only the important details.
- Abstraction
- Removing unnecessary detail from a problem so you can focus on what matters. A map of the Underground is an abstraction.
- Program
- A set of instructions written in a programming language that a computer can run.
- Selection
- Choosing which code to run depending on a condition, using if, elif and else.
- Output
- Information sent out from a computer, for example to a screen, speaker or printer.
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
In the UK traffic light sequence, which light comes straight after green?
Show the answer
Answer: amber
UK order: red, red and amber, green, amber, then red again.
What is (2 + 1) % 3 in Python?
Show the answer
Answer: 0
2 + 1 = 3. 3 ÷ 3 = 1 remainder 0, so 0.
Check you have got it
Answer 6 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
- National Curriculum in England, Key Stage 3: Computing programme of study
- The Highway Code: light signals controlling traffic (GOV.UK)
Facts checked against the sources below, 27 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.