AlbaCode
National 5 / Data Types / Data Types

Data Types

A look into the different types of data used within Python

Introduction

In programming, all stored data can be classified into one of five data types.

These are

  • Character
  • String
  • Integer
  • Real
  • Boolean

During this section you will learn to identify each of these.

Data Types

Character

A character is a single letter or symbol.

In Python, a character will be surrounded by quotation marks.

For example:

  • "A"
  • "M"
  • "@"

String

A sequence of characters (letters, numbers, and symbols).

In Python, a string will be surrounded by quotation marks.

For example:

  • "Car"
  • "15 Park Avenue"
  • "Steven"

Integer

A positive or negative whole number, without decimals.

For example:

  • 1
  • 73
  • -45

Real

A number which contains a decimal point.

For example:

  • 7.32
  • -42.5
  • 2.0

Boolean

A data type that only has 2 possible values

For example:

  • True / False
  • Yes / No
  • On / Off

When using python, a boolean is defined as True or False