Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Free lesson

Mean, median and range

After this lesson: I can work out the mean, the median and the range of a list of numbers.

50 min lessonNo commands

How long does a ticket take?

You join an IT support desk. Your team leader asks: "How long do we take to close a ticket?"

Most tickets close in about a quarter of an hour. One ticket stayed open all weekend.

One number has to describe all of them. Which number you choose changes the answer a lot.

By the end of this lesson

Note

I can work out the mean, the median and the range of a list of numbers.

Key words

WordWhat it meansExample
Meanthe total divided by how many values
Medianthe middle value once they are in order
Rangethe biggest value take away the smallest
Outliera value far from the others300 minutes
Summary statisticone number that describes many

The cells students fill in are left blank in this preview.

Worked example: the mean

StepWhat you doResult
1Write the times12, 15, 9, 20, 14
2Add them up70
3Count them5
4Divide the total by the count70 ÷ 5 = 14 minutes

The cells students fill in are left blank in this preview.

Work out the mean in Python

Code: python
# Minutes to close each support ticket this morning.
times = [12, 15, 9, 20, 14]

total = 0
for minutes in times:
    total = total + minutes

mean = total / len(times)
print("Total:", total)
print("Mean:", mean)

# Add a ticket of 300 minutes to the list. What happens to the mean?

A common mistake

Warning

Many people think the mean is always the typical value. It is only typical when there are no outliers. One ticket of 300 minutes lifts the mean from 14 to over 60. No ticket took that long.

The median is the middle value

To find the median, put the values in order and take the one in the middle.

With an even count there are two middle values. The median is halfway between them.

One huge value only moves the median one place. So the median is a fairer summary when there are outliers.

Worked example: median and range

StepFive ticketsSix tickets, one outlier
Times12, 15, 9, 20, 1412, 15, 9, 20, 14, 300
In order9, 12, 14, 15, 209, 12, 14, 15, 20, 300
Middle1414 and 15
Median1414.5
Range20 − 9 = 11300 − 9 = 291

The cells students fill in are left blank in this preview.

Median and range in Python

Code: python
times = [12, 15, 9, 20, 14, 300]

ordered = sorted(times)
print("In order:", ordered)

middle = len(ordered) // 2
if len(ordered) % 2 == 1:
    median = ordered[middle]
else:
    # An even count has two middle values: take halfway between them.
    median = (ordered[middle - 1] + ordered[middle]) / 2
print("Median:", median)

spread = ordered[-1] - ordered[0]
print("Range:", spread)

# Take 300 out of the list, then press Run again.

Teaching a class? Set this module for your students with a teacher guide, marked assignments and a lab for every student.