GCSE · Computer Science · AQA · Spec 8525
Character data type
You type 1, then 2, into a program that adds them. It prints 12. Nothing is broken: the program knows what kind of data it was handed.
Computer Science · Data types
Which data type does each value need?
Pick a value, then pick the data type that stores it correctly.
Still to sort
char (0)
Exactly one character: a letter, a digit or a symbol.
Where the line is: Char holds one character only. Text of several characters is a string, and a digit held as a character is still text, not a number.
string (0)
Text of any length, which can include numbers and symbols.
Where the line is: A string holds text. Several characters together, such as a password, are a string rather than a char.
integer (0)
Whole numbers.
Where the line is: An integer is a whole number you can calculate with. It is not the same thing as a digit held as text.
real (floating point) (0)
Decimal numbers.
Where the line is: If the number has a decimal part it is real. If it is whole it is an integer.
Boolean (0)
True or false.
Where the line is: Boolean values are true or false, so there is nothing else to store in them.
Commit to a type first. Then read why. Watch the two sevens: they look the same but belong in different places.
Computer Science · Data types
Why 1 + 2 can make 12
Step through the program. Watch what each variable holds, and what type it is, at every line.
The user types 1, then 2. Before you step through: what will the first print show?
1 a = input("First number? ")2 b = input("Second number? ")3 print(a + b)4 a = int(a)5 b = int(b)6 print(a + b)
| a | b |
|---|---|
| "1" (string) | (nothing yet) |
Output
Step 1: You typed 1, but input hands it back as a string, even though it looks like a number.
Nothing was wrong with the digits. The data type decided what + did.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
The character 7 and the number 7 look identical, but the computer treats them as completely different kinds of data.
What you need to know
- A data type is the kind of data a computer can store, plus the actions you can perform on it.
- The main data types are string (text), integer (whole numbers), Boolean (true or false), real or floating point (decimal numbers) and char (character).
Have a goA program stores a person's age in whole years and their height as 1.62 metres. Which data type suits each one?
Age is an integer. Height is real (floating point).
Whole numbers belong in integer, while a value with a decimal part belongs in real.
- The char data type holds a single character, for example the letter a.
- A single character can be a letter, a digit or a symbol, such as a, 7 or !.
- The character 7 is a piece of text, not the number seven.
Have a goYour classmate insists the character 7 must be the number seven, because 'it's literally a 7'. What do you tell them?
It is one character of text. It looks like the number seven but it is a different kind of data.
How a value looks does not decide its type. The character 7 is text, so it is not the number you calculate with.
- A string holds text of any length, including numbers and symbols, like the password p@ssw0rd!. A char holds just one character.
- Anything typed in with the input function comes back as a string, even if you type the number 15.
- Adding two strings joins them: the strings 1 and 2 make 12, not 3.
- The str, int and float functions convert (cast) a value to a string, an integer or a real number. Casting each input with int fixes the 12.
Have a goTwo typed-in values, the strings 4 and 5, are each cast with int and then added. What does the program print?
9
After the int casts both values are integers, so the plus sign adds them instead of joining them.
The big picture
A data type is the kind of data a computer stores. Char holds exactly one letter, digit or symbol as text, and a string holds text of any length. Typed-in numbers arrive as strings until you cast them.
Key points
Worked example
Problem
A program asks for someone's age and then prints their age next year. The user types 15. Write the line that stores the age, and say what is printed.
⚠ Watch out
Treating a digit as a number when it is really text. A digit typed in with input is a string, so adding two of them joins them (1 and 2 make 12) until each is cast with int. A digit stored as a char is also text, not a number.
Memory hook
A char 7 is just a drawing of a seven. Cast it with int and it becomes a number that counts.
Check yourself
Name the data type that suits each of these values: z, 0.5, true, sunshine. Then explain in one sentence why the character 0 is not the number zero.
Flashcards
(13)What is a data type?
Name the five main data types.
What does the char data type hold?
What can a single character be?
Is the character 7 a number?
What does a string hold?
Why can the password p@ssw0rd! not be a char?
Which data type stores the value true?
Which type for 24 players, and which for 3.14?
What type does the input function return?
What happens when you add two strings?
Which functions convert (cast) a value?
How do you make typed-in 1 and 2 add to 3?
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 postedMore AQA GCSE Computer Science topics
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 24 November 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.