Data types

About this lesson: Data types

In short

Every value has a data type. It decides what you can do with the value: you can add integers, but not a name. Move the slider through five examples.

Data types

What you'll explore

Five data types: Integer, real, character, string, Boolean
Every value has a data type. It decides what you can do with the value: you can add integers, but not a name. Move the slider through five examples.
Converting types: input() always gives text
input() returns a string, even if the user types a number. Adding 1 to a string causes an error. Convert it with int() first. Step through.
Choosing a type: Fit the type to the data
When you design a program, choose the right type for each item of data. Look at four examples.
Check yourself: Which type?
A program stores whether a light is switched on.

Also in this lesson

  • Common mix-ups
  • Types in action
  • Type sort

Words to know

data type
The kind of value: integer, real, character, string or Boolean.
integer
A whole number.
real
A number with a decimal part (float in Python).
string
Text made of characters.
Boolean
A value that is True or False.

Sources

  • BBC Bitesize KS3 Computer Science
  • Raspberry Pi Foundation, Computing curriculum resources

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 4 short steps and a 6-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 11 November 2026.

← Count-controlled loops in Python · Arrays and indexes →

All lessons in Term 1 · Computing · Age 13