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.

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