Python - Data Types Overview

5/31/2026

Data types are basically the categories that Python uses to classify and organize data, take a library for example. Just as a library categorizes books into fiction, non-fiction, biographies, and more, Python categorizes data into different types such as integers, floats, strings, and lists.

Unlike some other programming languages, in Python the data type is not declared in the variable definition. Instead, the data type of a variable is inferred automatically from the value it holds.

python

When this sample above is executed it will return the following result:

python

Common Data Types in Python

There are many built-in data types in Python. Each is designed to represent a specific category of data, such as numbers (integers, floats, and complex numbers), text (strings), and collections of values (lists, tuples, sets, and dictionaries). Let's take a look at some of these data types.

Data TypeDescriptionExample
intWhole numbers10
floatDecimal numbers3.14
strText values"Hello"
boolTrue or False valuesTrue
listOrdered collection of items[1, 2, 3]
tupleImmutable ordered collection(1, 2, 3)
setUnordered collection of unique items{1, 2, 3}
dictKey-value pairs{"website_name": "PyRepo"}

Numeric Data Types

Numeric data types are used to represent numbers in Python. These include whole numbers, decimal numbers, and complex numbers. The built-in numeric types are:

  • int
  • float
  • complex
python

Will return:

python

These data types allow Python to work with whole numbers, decimal numbers, and complex numbers.

Text Data Type

The built-in text data type in Python is:

  • str
python

Will return:

python

The str data type is used to represent textual data such as names, messages, sentences, and other sequences of characters.

Boolean Data Type

The built-in Boolean data type in Python is:

  • bool
python

Will return:

python

The bool data type is used to represent logical values and can hold either True or False.

Sequence Data Types

Sequence data types are used to store ordered collections of values. The built-in sequence types are:

  • list
  • tuple
  • range
python

Will return:

python

These data types allow multiple values to be stored and accessed in a specific order.

Set Data Type

The built-in set data type in Python is:

  • set
python

Will return:

python

The set data type is used to store unique values, meaning duplicate items are automatically removed.

Mapping Data Type

The built-in mapping data type in Python is:

  • dict
python

Will return:

python

The dict data type stores data as key-value pairs, allowing values to be accessed through their associated keys.

We have looked at the built-in data types available in Python, including numeric, text, Boolean, sequence, set, and mapping data types. Each of these data types serves a specific purpose and will be explored in greater detail in its own dedicated tutorial. Continue with the next tutorials to learn how to create, manipulate, and work with each data type effectively.