GCSE · Computer Science · AQA · Spec 8525

Integer data type

Your phone number is nothing but digits. So why would a good programmer never store it as a number?

Computer Science · Data types

Integer or not? You decide

Would you store this value as an integer? Pick a value, then pick where it belongs.

Still to sort

Store as an integer (0)

Whole numbers — positive, negative or zero — that you count or calculate with.

Where the line is: Being made of digits isn't enough. The value must be a whole number that behaves like an amount.

Needs a different data type (0)

Values with a fractional part, or digits that are really a label.

Where the line is: A fractional part rules integer out. So does a value you'd never do sums with.

6 of 6 still to sort.

Six values a program might need to store. Sort each one, then read why.

Watch out: All digits doesn't mean integer. Ask two questions: is it a whole number, and would I count or calculate with it?

Computer Science · Data types

Where integer fits among the common data types

Tick every property each data type has. Then check your grid.

Integer
Real (often called float)
String
Boolean

Computer Science · Data types

Find the line where the type goes wrong

This program should ask how many tickets you want and print the total cost. Tickets cost 4 each. The user types 3, and the program prints Total cost: 3333 instead of Total cost: 12. Which line is wrong?

A Python program with one bug — which line goes wrong?

Computer Science · Data types

Choose the type — and say why

A sports day program stores two values for each race: the number of runners in the race, and the winning time in seconds, such as 12.84. State the most suitable data type for each value and justify each choice. [4 marks]

0 words · your answer stays on this page and is not sent anywhere.

UK note

AQA exam questions use the general names integer, real, Boolean, character and string. Write integer, even if the language you use calls it int.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Not every value made of digits is one — and choosing wrong can break a program.

What you need to know

  • A data type decides what kind of value can be stored and what the program can do with it.
  • An integer is a whole number: positive, negative or zero, with no fractional part.
  • Choose integer for whole-number values you count or calculate with, such as scores, quantities and floor numbers.
  • Common data types include integer, real (float), string and Boolean.
  • Languages have their own names for types — Python calls the integer type int — but the general name is integer.
  • Using an incorrect data type can cause errors: the program may stop, or it may run and give a wrong answer.

The big picture

A data type tells a program what kind of value it is holding and what it can do with it. The integer type holds whole numbers — positive, negative or zero — and it is the right choice for values you count or calculate with. Digits that are really a label, like a phone number, belong in a string, and values with a fractional part need a real. Choose the wrong type and a program can stop with an error or, worse, quietly give the wrong answer.

Key points

1Integer means whole: -2 and 0 are integers; 1.25 is not.
2Digits alone don't make an integer. A phone number is stored as a string, because you never do sums with it and its leading 0 must survive.
3In Python, input() always returns a string. Convert it with int() before doing arithmetic with it.
4A type error can hide: "3" * 4 gives "3333" in Python, not 12, and nothing warns you.

Worked example

Problem

A cinema records how many people watched a film on each of 5 nights: 120, 135, 128, 141 and 130. The program stores each night's attendance and also the mean attendance. Choose a data type for each night's attendance and for the mean.

⚠ Watch out

Choosing integer just because a value is made of digits. A phone number or a PIN like 0042 is all digits, but you never calculate with it, and storing it as an integer loses the leading zeros. Store it as a string.

🧠

Memory hook

Whole, and worth doing sums with? Integer. Got a point in it, or just digits used as a label? Not an integer.

✓

Check yourself

Which of these values could be stored as an integer: 17, -40, 0, 2.5 and a door code written as 0199? For each one you rule out, say which property rules it out.

Flashcards

(10)
What does a data type decide?
What kind of value can be stored, and what the program can do with it.
What is an integer?
A whole number — positive, negative or zero — with no fractional part.
Are -5 and 0 integers?
Yes. Negative whole numbers and zero are both integers.
When should you choose the integer type?
For whole-number values you count or calculate with, like scores or quantities.
Why isn't a phone number stored as an integer?
It's a label, not an amount: you never do sums with it, and as an integer its leading 0 would be lost. Store it as a string.
Which type holds a value like 2.75?
Real (often called float), because it has a fractional part.
Name four common data types.
Integer, real (float), string and Boolean.
Python calls it int. What is the general name?
Integer.
In Python, what type does input() give back?
A string. Use int() to convert it before doing arithmetic.
What can go wrong if a value has the wrong data type?
The program may stop with an error, or run and give a wrong answer without any warning.

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.