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

Preview

AC 2.3: Catching typing slips with a check digit

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

55 minutes

Two digits swapped

A librarian types a long card number. She swaps two digits by accident. Both numbers look fine, and both could belong to real pupils.

Checking the size of the number cannot see the slip. Counting the digits cannot either. A different kind of check can.

Key words

WordWhat it meansExample
Check digitan extra digit, worked out from the other digits, added to the end of a number
Weightthe number a digit is multiplied by, set by its place
Modulusthe remainder left after dividing67 divided by 10 leaves 7
Transpositiontwo digits swapped by mistake
Validationa check that data is sensible when it is entered

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

By the end of this lesson

Note

I can work out a check digit, use it to test a number, and say which mistakes it catches.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

How a check digit works

The system takes the digits and does a sum on them. The answer becomes one extra digit, stuck on the end.

When the number is typed again, the system repeats the sum. If the last digit does not match the answer, a slip has happened.

Our library card scheme

A card has six digits and a check digit. Multiply the digits by 1, 2, 3, 4, 5 and 6 from the left. Add the answers. The check digit is the last digit of the total.

Real schemes work the same way with other weights. The 13-digit number on a book, the ISBN, uses weights of 1 and 3 in turn.

Worked example: card 402173

DigitWeightDigit times weight
414
020
236
144
7535
3618
Total67
Check digit: last digit of 677

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

Try it: work it out in Python

Code: python
digits = "402173"
total = 0
place = 1
for ch in digits:
    total = total + int(ch) * place
    place = place + 1
print("total", total)
print("check digit", total % 10)

# Swap the 0 and the 2: use "420173". What is the check digit now?

Check

Have a go

Check

4 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

The lesson goes on

5 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.