Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only T&Cs apply

Find out more

Data types

Data comes in different shapes and sizes. Jeremy Singer illustrates the concept of data type with a range of examples.
5.6
JEREMY: Data is everywhere. It’s really important when we’re looking at data and analysing it to be able to describe the data properly. And the way to do this is to use data types in computing terms. Let’s look at a few examples. Here’s my dice. And this is a 20-sided dice from a Dungeons and Dragons game, I think. And when I roll it, it’s going to give me a number. So there, for instance, is the number 3. Every time I roll it, I’m going to get an integer, or whole number value. An integer is a specific data type. For instance, I might be observing the number of people in a building, it’s an integer.
58.3
Or the number of legs that an insect has, it’s an integer. Sometimes when we’re measuring numerical data, however, it might not be integer whole number data. So I might be measuring the length of something. And that’s going to be a real number or a number with a decimal point, and the value after the decimal point. In computing terms, we can call these real numbers. Sometimes we call them floating point numbers. So for instance, my head circumference– hang on– is apparently 56.5 centimetres. Not sure that’s accurate. But you see, it’s not a whole number. It’s got a decimal point. And then a number after the decimal point. So this is a real number.
104.5
Or in computing terms, the data type is a floating point, 56.5. There are other data types as well. So here’s my University of Glasgow calendar, oh dear, from 2016. A little bit out of date. And we could take observations on certain days. And the day itself becomes a piece of data. So a date is another data type. For instance, a person’s birth date is a feature. And this has the date data type, recording the month and the year and the day, and so on. Sometimes, we describe data using words. So for instance, we might want to talk about places and place names are words. Here is Glasgow. And this is in data type terms a character string.
159.6
Each letter is a single character. And we group them together to make this string of characters or word. String is the computing data type. And multiple words can be a string as well because space is a character too. So we could describe things like people’s jobs as character strings. Or perhaps we could describe the weather as a character string. Or perhaps it might be something else, like people’s comments, or opinions about a certain event. All these things could be character strings. One other data type we want to think about is the Boolean data type. And for this, we’re going to use the example of a light switch. The light switch is either on or off.
207.5
And the Boolean data type is either true or false, on or off. All these data types we know map directly down to computer bits, ones and zeros. That’s easy for the Boolean case, isn’t it? One is true and zero is false. But when you collect together lots of bits, then you can represent more complex data types, like character strings and the integers and the dates and the floating point numbers.

Data comes in different shapes and sizes. We use data types to represent different values in computer code.

Regular types include integer for whole numbers, floating-point for non-whole numbers, boolean for true/false values, and string for textual data. Have you encountered data types in computer coding before?

This article is from the free online

Getting Started with Teaching Data Science in Schools

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now