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.

8 of 8 still to sort.

Eight values a program might store. Decide first, then read the reason.

Integer vs real

IntegervsReal

A data type defines the kind of data a computer can store and the actions that can be performed on it. Integer and real are two number types. Here is how they differ.

Focus

Can it hold a fractional part?

Integer

No. Whole numbers only, like 3.

Real

Yes. For example 5.3.

The insight

This is the difference that decides everything else. If a value might have a bit after the point, integer is out.

How the whole number 5 appears

Integer

5

Real

5.0

The values it suits

Integer

Values that are always whole, such as a count.

Real

Values that can be non-whole: a measurement, a price, an average.

Numeric, so usable in arithmetic?

Integer

Yes

Real

Yes

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.

Python
  1. tickets = 5.0
  2. print("Tickets sold:", tickets)

Outputs checked by running each program in Python 3. Python calls the real type float.

Computer science · Data types

Which idea is closest to yours?

You are choosing data types for a program that stores how many tickets were sold and what each ticket costs.

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

Computer science · Data types

Choose and justify

A program stores the number of apples in a bag and how heavy the bag is in kilograms. Choose a data type for each value and give a reason for each. [4 marks]

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

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

1Ask of the value: could it ever have a fractional part? If yes, use real. If never, use integer.
2A count is always whole, so it is an integer. A measurement, price or average can be non-whole, so it is real.
3The whole number 5 is 5 as an integer but 5.0 as a real.
4The wrong type can give an unwanted result or lead to errors, so choose it on purpose.

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?
It defines the kind of data a computer can store and the actions that can be performed on it.
What does the real data type hold?
Numbers that can have a fractional (decimal) part, such as 5.3. It is also called floating point.
What does 5 look like if it is held as a real?
5.0. A real carries a fractional part even for a whole number.
What does the integer data type store?
Whole numbers only, such as 3.
Can an integer hold a fractional part?
No. So any value that can have a fractional part needs the real data type.
Which kinds of value suit real?
Values that can take non-whole amounts: a measurement, a price, an average.
Which kinds of value suit integer?
Values that are always whole numbers, such as a count.
What one question picks between real and integer?
Could this value ever be non-whole? If yes, real. If never, integer.
What can go wrong if you use real for a whole number you meant?
You can get an unwanted result, for example 5.0 instead of 5.
Can real values be used in arithmetic?
Yes. Real values are numeric, so they can be used in arithmetic calculations.
Why does choosing the right data type matter?
The computer uses the data type to store and process the data correctly, and a wrong type can lead to errors in a program.

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 Eduqas GCSE Computer Science topics

See the full Eduqas Computer Science curriculum →

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.