GCSE · Computer Science · Eduqas · Spec C500QS
Real data type
Your program says you sold 5.0 tickets. Five point zero? Nobody sells 5.0 tickets. Let's find out why, and fix it.
Computer science · Data types
Real or integer?
For each value ask yourself: could this ever have a bit after the decimal point? Commit to Real or Integer, then check the reason.
Still to sort
Real (0)
Can take non-whole amounts: a measurement, a price, an average.
Where the line is: Ask 'could it ever be non-whole?', not 'is it whole right now?'. A value that happens to be 5 today but could be 5.3 tomorrow still needs real.
Integer (0)
Always a whole number, like a count.
Where the line is: Integer only works when the value can never have a fractional part, because an integer cannot hold one.
Eight values a program might store. Decide first, then read the reason.
Computer science · Data types
Fix the ticket counter
This program keeps a count of tickets sold. Run it, read what it prints, and decide if that is how a count should look. If not, choose a fix for line 1.
- tickets = 5.0
- print("Tickets sold:", tickets)
Outputs checked by running each program in Python 3. Python calls the real type float.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Whole number or decimal? Pick the type that fits the value.
What you need to know
- A data type defines the kind of data a computer can store and the actions that can be performed on it.
- Real (also called floating point) holds numbers that can have a fractional, decimal part, like 5.3.
- Even a whole number gets a fractional part when held as a real: 5 becomes 5.0.
Have a goSam says: 'I'll store the whole number 7 as a real, and it'll print as plain 7.' What will it actually look like?
7.0
A whole number held as a real still carries a fractional part, so it shows as 7.0, not 7.
- Integer is the opposite: it stores whole numbers only, like 3.
- An integer can't hold a fractional part, so any value that can have one needs real.
- Real suits measurements, prices and averages. Integer suits values that are always whole, such as a count.
Have a goQuick pick: 'seats on a bus' or 'average age of the passengers'. Which one needs the real data type?
The average age.
An average can be non-whole, while a count of seats is always whole, so seats suit integer.
- Use real where you meant a whole number and you can get an unwanted result, like 5.0 instead of 5.
- Real values are numeric, so you can use them in arithmetic calculations.
Have a goYou add 2.5 and 1.5, both held as reals. Is the answer 4 or 4.0?
4.0
Reals are numeric, so the sum works, and a whole-number value held as a real still carries its fractional part.
- The computer uses the data type to store and process data correctly, so a wrong type can cause errors in a program.
The big picture
A data type is the kind of data a computer can store and the actions you can perform on it. Real holds numbers that can have a fractional part; integer holds whole numbers only. To choose, ask whether the value could ever be non-whole.
Key points
Worked example
Problem
A weather-station program must store three values: (a) the number of rainy days this month, (b) the temperature reading right now, 14.5 °C, and (c) the average temperature for the month. Choose integer or real for each and say why.
⚠ Watch out
Choosing the type from today's number instead of from what the value can be. An average that comes out as exactly 6 today can be 6.4 tomorrow, so it still needs real.
Memory hook
Whole every time? Integer. Might there be a bit after the point? Real.
Check yourself
Without looking back: you need to store the distance from a pupil's home to school. What question do you ask to choose between integer and real, and what do you decide?
Flashcards
(11)What is a data type?
What does the real data type hold?
What does 5 look like if it is held as a real?
What does the integer data type store?
Can an integer hold a fractional part?
Which kinds of value suit real?
Which kinds of value suit integer?
What one question picks between real and integer?
What can go wrong if you use real for a whole number you meant?
Can real values be used in arithmetic?
Why does choosing the right data type matter?
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 Eduqas GCSE Computer Science topics
How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)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 16 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.