GCSE · Computer Science · AQA · Spec 8525

Character codes grouping/sequencing

Know just one code, 'A' = 65, and you can work out every capital letter's code in your head. Plus: why the character '7' doesn't have the code 7.

Computer Science · Character codes

Which run does each code belong to?

Your table only tells you three things: 'A' is 65, 'a' is 97 and '0' is 48. Pick a code, then put it in the group it belongs to. Before you place it, work out how far along the run it is, and keep an eye on where each run stops.

Still to sort

Capital letters (0)

The run starts at 'A' = 65

Where the line is: 26 capital letters, one code each, no gaps. But the last one isn't at 65 + 26. Hold that thought: you'll see why in a moment.

Lower case letters (0)

The run starts at 'a' = 97

Where the line is: A separate run of 26, with its own first code. 'a' and 'A' are different characters, so they have different codes.

Digit characters (0)

The run starts at '0' = 48

Where the line is: Just ten digit characters, '0' to '9'. '9' is 9 places after '0', and the run ends there.

None of these groups (0)

Not a capital, not lower case, not a digit

Where the line is: A code one below a run's first code, or one above its last, is outside that run. The ends are where counting goes wrong.

8 of 8 still to sort.

65, 97 and 48 are the real ASCII codes for 'A', 'a' and '0'. Every other code on this board was worked out from just those three.

Predict, then check

No full table, just one known code and some careful counting.

Your table says 'A' is 65. 'Z' is the 26th and last capital letter. What is the code for 'Z'?

Digits are characters too

What's the code for '7'?

Someone types the digit 7 into a message. Your table says 'A' is 65 and '0' is 48.

What code does the character '7' have? Pick the idea closest to what you think right now.
How sure are you?

Your turn: code to character

Which character is code 109?

Your table says 'A' = 65, 'a' = 97 and '0' = 48. Which character has the code 109?

  1. Which group? 109 is bigger than 97, and the lower case run only reaches 'z' = 97 + 25 = 122. So 109 is a lower case letter.
  2. missing step
Which line is step 2?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Why one known code is enough to work out a whole alphabet of them, and why the character '7' doesn't have the code 7.

What you need to know

  • What it means for character codes to be grouped and to run in sequence
  • How to work out any code in a group from the group's first code
  • Why the digit character '7' doesn't have the code 7
  • How to use a given table to turn characters into codes, and codes back into characters

The big picture

Character codes are grouped: capital letters, lower case letters and digits each have their own group, and inside a group the codes run in sequence, going up by one. So a group's first code unlocks the rest: count the places after the first character and add them on. With 'A' = 65, 'Z' is 25 places along, so it's 90. Digits have their own run too: with '0' = 48, the character '7' is 55. Going from code to character, find the run, take away its first code and count on.

Key points

1Character codes are grouped. Capital letters, lower case letters and digits each form their own group.
2Within a group the codes run in sequence, going up by 1 each time: if 'A' is 65, then 'B' is 66, 'C' is 67, and so on.
3So one known code is enough. A character's code = the group's first code + the number of places after the first character.
4Count the places AFTER the first character, not the letter's position: 'Z' is 25 places after 'A', so with 'A' = 65, 'Z' is 90.
5Capital and lower case letters are separate runs with different codes: in the table used here, 'A' is 65 but 'a' is 97.
6Digits are characters with their own run. With '0' = 48, the character '7' is 55, not 7.
7Code to character: find which run the code is in, take away that run's first code, then count on that many places.

Worked example

Problem

A character table gives 'A' = 65, 'a' = 97 and '0' = 48. Write the character codes for the text Cab2.

⚠ Watch out

Adding the letter's position in the alphabet instead of the places after the first letter, which gives 'Z' as 65 + 26 = 91 instead of 65 + 25 = 90. 'A' is 0 places along its own run, so every letter is one place fewer than its position.

🧠

Memory hook

First code, then count on. 'A' is 0 steps from itself, so the 26th letter is only 25 steps away.

✓

Check yourself

Using only 'A' = 65, 'a' = 97 and '0' = 48, write the codes for Wok4. Then decode your codes by counting on. Get Wok4 back? You've got it.

Flashcards

(7)
What does it mean that character codes 'run in sequence'?
Inside a group, each next character has the next code up. If 'A' is 65, 'B' is 66, 'C' is 67, and so on.
Which three groups of characters each have their own run of codes?
Capital letters, lower case letters and digits. Each group is one unbroken run with its own first code.
You know the code for 'A'. How do you find the code for any other capital letter?
Count how many places after 'A' the letter is, then add that to the code for 'A'.
If 'A' is 65, why isn't 'Z' 65 + 26?
'A' is 0 places along its own run, so 'Z', the 26th letter, is only 25 places after 'A'. Its code is 65 + 25 = 90.
Does the character '7' have the code 7?
No. '7' is a character in the digit group. Count on from the code for '0': if '0' is 48, '7' is 55.
Do 'A' and 'a' share a code?
No. Capital and lower case letters are separate groups with separate runs, so 'A' and 'a' have different codes.
How do you turn a code back into a character?
Find which run the code is in, take away that run's first code, then count on that many places from the first character.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.