In this article, you are going to see a brief overview of different Python data types. Data types in a programming language refer to the type of data that the language can work with. While developing an application, you need to work with data of different types, for example, numbers, text, booleans, etc. Python programming language also supports a variety of data types. Some of the basic python data types are enlisted below:

  1. Numeric Types
  2. Strings
  3. Booleans
  4. Lists
  5. Tuples
  6. Dictionaries

It is important to mention that the Python data types can be used as constants or variables. Python is not a strongly typed language which means that you do not need to specify the data type with the variable name.

Let’s briefly take a look at various Python data types with examples.

Numeric Types

Numeric types in Python, as the name suggests, store numeric data. The numeric types in Python are further divided into three types:


The integer type variables are used to store integers of any length. Look at the following example.

age = 10 

Here we create an integer variable age and assign it the value 10. Next, using the type() method, the type of the age variable is printed. In the output, you should see “<class ‘int’>”


<type 'int'>


Float type variables store numbers with decimals with a precision of up to 14 decimal points. Here is an example:

weight = 170.56


<type 'float'>

Complex Numbers

You can also store complex numbers in Python variables. A complex number consists of magnitude and dimension. The magnitude of a complex number is represented by the numeric part while the dimension is represented by the character. Here is an example:

salary = 10 + 5j


<type 'complex'>


Python treats strings as sequences of characters. Strings store textual data in Python. Here is an example of how to use strings in Python:

name = "Joseph Juana"

In the script above, we create a string variable called name. Next, we print the type of the variable and the length of the string. The len() function counts the number of characters in a string. Here is the output of the above script:


<type 'str'>


Boolean variables are used to store boolean values i.e. True or False. Here is an example:

married = True
have_kids = False


In the script above we create two boolean variables: married and have_kids. The first variable contains True while the second variable contains False value. Finally, the type of both variables is printed.


<type 'bool'>
<type 'bool'>

Python data types can also be used to store a collection of items. In this regard, Python offers three data types: lists, tuples, and dictionaries. Let’s review them one by one.


Python lists store a collection of items of the same or different data types. Python lists are mutable which means that you can update, delete, and add items to a Python list. You can also clear a Python list.

To create lists, you need to pass individual values and separate them by commas inside square brackets, Let’s see a very simple example of a list in Python.

planets = ["Earth", "Mars", "Saturn", "Venus", "Jupiter", "Uranis", "Mercury","Neptune", "Venus"]


<type 'list'>

To study more about how to use lists in Python, check out our detailed guide on Python lists.


Like lists, tuples also store a collection of items. However, unlike lists, tuples are immutable. Hence, you can add, remove or update items in a tuple. To create tuples, you have to pass a collection of items inside round brackets. Here is a very simple example of a tuple in Python.

planets_tuple = ("Earth", "Mars", "Saturn", "Venus", "Jupiter", "Uranis", "Mercury","Neptune", "Venus")


<type 'tuple'>

As I said earlier, you cannot update a tuple. Let’s try to update the value at the second index of a tuple and see what happens:

planets_tuple[2] = "Sun"


TypeError Traceback (most recent call last)
----> 1 planets_tuple[2] = "Sun"

TypeError: 'tuple' object does not support item assignment

The output shows that the tuple assignment is not possible.


Dictionaries also store a collection of items, but in the form of key-value pairs. Each item consists of a key and a value, which are separated via a colon. The items in a dictionary are separated from each other via a comma. Dictionary items are stored inside curly brackets. Here is an example of a simple dictionary.

patient_dict ={"Name": "John", "Age":10, "Blood_Group":"B+"}

The script above creates a dictionary patient_dict. The script then prints the type of the variable patient_dict.


<type 'dict'>

If you wish to learn more about Python, check out our collection of Python tutorials.