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.

Practise this lesson free (6 questions)

More tools

State and behaviour

A model needs to store the state of the system: the data that describes it right now, such as the current light colour or the temperature.
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

UK traffic lights go: red, red and amber, green, amber, then back to red.
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

target = 20
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?
Worked example

In the traffic light model, what is shown after amber (now = 3)?

  1. now = (3 + 1) % 4 = 0.
  2. states[0] is red.

Answer: red

Key idea

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.

Key words
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.

All KS3 Computing key terms and definitions →

Quick check

Try two quick questions

See if it has sunk in. Answers are marked straight away.

Extra practice

2 more questions

Try each one, then tap to check.

  1. 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.

  2. 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.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

Facts checked against the sources below, 27 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.