GCSE · Computer Science · AQA · Spec 8525
Concept of a data type
Type 5, then 3, into a program that adds them, and it proudly answers 53. It isn't broken — it's doing exactly what the data types tell it to.
Computer Science · Data types
Why did 5 + 3 give 53?
A short Python program asks the user for two numbers and adds them. Step through it one line at a time and keep an eye on the quotation marks in the Variables panel.
The user types 5, then 3. Before you step onto line 3, predict: what will print(first + second) show?
1 first = input("First number: ")2 second = input("Second number: ")3 print(first + second)4 first = int(first)5 second = int(second)6 print(first + second)
Variables
Output
First number: 5
Step 1: The user types 5. But input() always hands back text, so first holds the string "5" — the character 5, not the number 5. Spot the quotation marks.
Press Next one line at a time. The moment to watch is line 3 — then compare it with line 6.
Computer Science · Data types
Sort the values by data type
Which data type is each value? Pick a value, then pick its type.
Still to sort
Integer (0)
A whole number — positive, negative or zero.
Where the line is: No fractional part. As soon as a number is written with a decimal point, even 5.0, it is a real.
Real (float) (0)
A number with a fractional part. Also called floating point, or a float.
Where the line is: It is how the number is written that counts: 5.0 is a real even though its value is whole.
Boolean (0)
Only ever one of two values: True or False.
Where the line is: True with no quotation marks is a Boolean. Put it in quotation marks and it becomes a string of four letters.
Character (0)
A single letter, digit or symbol.
Where the line is: Exactly one symbol. Two or more characters together make a string. (Some languages, such as Python, have no separate character type and simply use a string of length one.)
String (0)
A sequence of characters, written inside quotation marks.
Where the line is: Anything inside quotation marks is text — even if every character in it is a digit.
Five data types come up again and again. Commit to an answer for each value before you read the reason.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Why "5" and 5 are not the same thing, and how to convert between them.
What you need to know
- A data type is the kind of value a piece of data is. It decides which values the data can take, how it is stored and which operations work on it.
- Integer: a whole number, such as 42, -7 or 0.
- Real (also called floating point, or float): a number with a fractional part, such as 3.75 or 5.0.
- Boolean: only two possible values, True or False.
- Character: a single letter, digit or symbol, such as 'A'. String: a sequence of characters, such as "hello" or "42".
- Casting converts a value from one data type to another: int("5") gives the integer 5, and str(20) gives the string "20".
The big picture
Every value in a program has a data type: integer, real, Boolean, character or string. The type decides which values the data can take, how it is stored and which operations work on it — so the same + adds two integers but joins two strings. Casting converts a value from one type to another, and choosing the right type in the first place avoids errors and wrong answers.
Key points
Worked example
Problem
A leisure centre's membership program needs to store six things about each member: their name, their age in years, their height in metres, whether they have paid this month, their membership grade (a single letter, A to C) and their phone number. Choose the most suitable data type for each, with a reason.
⚠ Watch out
Treating digits as a number just because they look like one. "42" in quotation marks is a string: until you cast it with int(), + will join it rather than add it, and in Python, mixing it with an integer causes an error.
Memory hook
Quotation marks are a disguise: "42" looks like a number, but it's text in a costume. Casting takes the costume off.
Check yourself
Cover the page. Name the five data types with an example of each. Then say why "7" + "7" doesn't give 14, and what would fix it.
Flashcards
(11)What is a data type?
Integer
Real (float)
Boolean
Character
String
Is "42" a number?
What is casting?
What is concatenation?
What type does keyboard input usually arrive as?
What can go wrong if you choose the wrong data type?
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 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.