Data Types in Python: Complete Guide to Every Type of Data in Python with Examples
Introduction: Why Learn Data Types in Python?
Back when I was first learning how to code in Python, one of the hardest topics for me to grasp was data types in Python. All programming languages have their own syntax to work with numbers, text, and collections, and Python is no different. Defining which data type a variable is essentially gives you information on how to write your code, and which data types are efficient.
Table Of Content
- Introduction: Why Learn Data Types in Python?
- What Are Data Types in Python?
- Types of Data in Python (with Examples)
- 1. Integer (int)
- 2. Float (float)
- 3. Complex (complex)
- 4. String (str)
- 5. Boolean (bool)
- Collection Data Types in Python
- 6. List (list) β Mutable Collection
- 7. Tuple (tuple) β Immutable Collection
- 8. Set (set) β Unique Elements
- 9. Dictionary (dict) β Key-Value Pairs
- Mutable vs Immutable Data Types in Python
- Type Conversion in Python
- Quick Summary Table of Python Data Types
- Real-World Applications of Python Data Types
- FAQs on Data Types in Python
- Conclusion
- Related Links
In this article, we will go through all the data types in Python, discuss how they may be used in real life, and provide examples of code that you can use right away. When you finish this article, you will not only understand variables and built-in types in Python, you will also know how to choose the right variable for your next project.
What Are Data Types in Python?
A data type will indicate what kind of value a variable can take or what operation can be performed on it. For example:
x = 10Β Β Β Β Β Β Β # this is an integer
y = “Python”Β # this is a string
z = 3.14Β Β Β Β Β # this is a float
x is an integer; y is a string; z is a float. Each value is a different type of data in Python.
The two main types in Python are:
- Primitive Data Types (or any basic built-in type such as int, float, str, bool)
- Non-Primitive / Collection Data Types (such as list, tuple, set, dictionary)
Types of Data in Python (with Examples)

Letβs go step by step through the different types of data in Python.
1. Integer (int)
- Whole numbers, positive or negative, without decimals.
age = 25print(type(age))Β # <class ‘int’>
2. Float (float)
- Numbers with decimals.
pi = 3.14159print(type(pi))Β # <class ‘float’>
3. Complex (complex)
- Numbers with real and imaginary parts.
z = 5 + 3jprint(type(z))Β # <class ‘complex’>
4. String (str)
- Text enclosed in quotes.
name = “Python”print(type(name))Β # <class ‘str’>
5. Boolean (bool)
- Logical values: True or False.
is_active = Trueprint(type(is_active))Β # <class ‘bool’>
Collection Data Types in Python
Python also provides powerful data structures to handle multiple values.
6. List (list) β Mutable Collection
fruits = [“apple”, “banana”, “cherry”]print(type(fruits))Β # <class ‘list’>
7. Tuple (tuple) β Immutable Collection
coordinates = (10, 20)print(type(coordinates))Β # <class ‘tuple’>
8. Set (set) β Unique Elements
unique_nums = {1, 2, 3, 3}print(unique_nums)Β # {1, 2, 3}
9. Dictionary (dict) β Key-Value Pairs
student = {“name”: “John”, “age”: 21}print(type(student))Β # <class ‘dict’>
Mutable vs Immutable Data Types in Python

- Mutable β can be changed (list, dict, set).
- Immutable β cannot be changed (int, float, str, tuple).
This distinction is crucial for memory management and performance.
Type Conversion in Python
Python lets you convert between data types easily:
x = “100”y = int(x)Β # Convert string to integerprint(y, type(y))Β # 100 <class ‘int’>
Quick Summary Table of Python Data Types
| Data Type | Example | Mutable/Immutable | Use Case |
| int | 10 | Immutable | Counting, IDs |
| float | 3.14 | Immutable | Scientific calc |
| str | “Hello” | Immutable | Text storage |
| bool | True | Immutable | Conditions |
| list | [1,2,3] | Mutable | Collections |
| tuple | (1,2,3) | Immutable | Fixed data |
| set | {1,2,3} | Mutable | Unique values |
| dict | {“a”:1} | Mutable | Key-value storage |
Real-World Applications of Python Data Types

- Integers & Floats β Banking systems, statistics, and AI calculations.
- Strings β Chatbots, NLP, and data entry systems.
- Lists & Tuples β Storing datasets in Machine Learning.
- Dictionaries β JSON, APIs, and configuration files.
- Sets β Removing duplicates in large datasets.
FAQs on Data Types in Python
Q1. How many types of data exist in Python?
There are 9 standard built-in types in Python. They are: int, float, complex, str, bool, list, tuple, set, dict.
Q2. What is the difference between a list and a tuple?
A list is mutable while a tuple is immutable.
Q3. What is the meaning of mutable and immutable types in Python?
Mutable types can be changed (lists, sets, dicts) while immutable types cannot be changed (int, float, str, tuple).
Conclusion
Becoming familiar with data types in Python is the first step to becoming a confident Python programmer. There are many different kinds of data types, so even if you do not have any intention of implementing collection data types like lists and dictionaries right away, it is still good to know they exist.
If you are a beginner, create some experiments with each type, try type conversions, and write simple programs. Once you fully understand the basic data types in Python, you will feel more comfortable moving onto bigger concepts like functions, OOP, and data structures.
If you really want to build a solid foundation, look to take a Python course online or in your local community. Online courses often offer comprehensive training to help you understand data types in Python, but they also provide insight into real-world projects, best practices, and advanced topics.

