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.

9 of 9 still to sort.

Commit to a type first. Then read why. Watch the two sevens: they look the same but belong in different places.

Char or string?

charvsstring

Both hold text. Find the one thing that is different.

Focus

How many characters it holds

char

Exactly one

string

Any number: one word, a whole password, and more

The insight

This is the whole difference. Count the characters first and the type usually follows.

Can it hold letters, digits and symbols?

char

Yes: one letter, one digit or one symbol

string

Yes: letters, digits and symbols mixed together

Example

char

a, 7 or !

string

p@ssw0rd!

Is a digit inside it a number?

char

No: the character 7 is text

string

No: the string 12 is text

Computer Science · Data types

What is a stored character 7, really?

A program stores the character 7 in a char.

Which idea is closest to what you think right now?
How sure are you?

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)
ab
"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.

1 / 6

Nothing was wrong with the digits. The data type decided what + did.

Step 1 of 6: You typed 1, but input hands it back as a string, even though it looks like a number..

Computer Science · Data types

Finish the program

A program asks for a ticket price (it can have pence) and a number of tickets, then prints what is owed. Choose the missing line each time.

  1. name = input("Your name? ")A name is text, and input already returns a string, so no cast is needed here.
  2. missing step
Which line is step 2?

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

1The type decides what a program does with a value. The same two digits can be added or joined, depending on whether they are numbers or text.
2Char means exactly one character. A value with several characters, such as a password, has to be a string.
3Input returns a string, so cast typed-in numbers before you calculate with them.
4Use str, int or float to convert a value to a string, an integer or a real number.

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?
The kind of data a computer can store, and the actions you can perform on it. Programs use data types so that data is stored and processed correctly.
Name the five main data types.
String (text), integer (whole numbers), Boolean (true or false), real or floating point (decimal numbers) and char (character).
What does the char data type hold?
Exactly one character, for example the letter a.
What can a single character be?
A letter, a digit or a symbol, such as a, 7 or !.
Is the character 7 a number?
No. The character 7 is a piece of text, not the number seven.
What does a string hold?
Text of any length. It can also hold numbers, characters and symbols, for example the password p@ssw0rd!.
Why can the password p@ssw0rd! not be a char?
A char holds only one character, and the password has several.
Which data type stores the value true?
Boolean, which stores true or false.
Which type for 24 players, and which for 3.14?
24 is a whole number, so integer. 3.14 is a decimal number, so real (floating point).
What type does the input function return?
A string, even if the user types a number such as 15.
What happens when you add two strings?
They are joined (concatenated). The strings 1 and 2 make 12, not 3.
Which functions convert (cast) a value?
str to a string, int to an integer, float to a real number.
How do you make typed-in 1 and 2 add to 3?
Cast each input with int, so both are integers before they are added.

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 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.