What Are Data Types?
Data types are the most important part of any programming language, because they tell Python and other languages what kind of value a variable is holding.
We have various values in our program, such as numbers, text, lists of items, or more complex structures, so Python uses data types to understand how a particular value should behave in operations.
In other languages, we need to mention the data type when creating a variable, but Python doesn’t need to describe any types. It will automatically detect the value type of the value you assign.
Let’s understand simple example:
x = 20 # Integer
y = 4.20 # Float
z = "Hello" # String
This functionality makes our coding faster and more flexible in real world projects.
Categories of Python Data Types
Python provides several built-in data types, and each categories serves a unique purpose and helps you store and manage different kinds of data efficiently.

Below we describe each data type of Python:
- Numeric
- Sequence
- Mapping Types
- Set Types
- Boolean Type
- None Type
1. Numeric Types
Numeric data types store all the numbers in multiple forms. Python supports three numeric types, such as:
a) Integer (int): Stores whole numbers, either positive or negative, without a decimal point. For example:
age = 25
print(type(age))
# Output: <class 'int'>
- Here we print the type of data using the type keyword so which gives you ‘int’ as an output.
b) Floating Point (float): A float stores a number with a decimal point or in exponential form. For example:
price = 19.99
print(type(price))
# Output: <class 'float'>
c) Complex (complex): Complex types are the numbers with a real and an imaginary part. Let’s see the simple example:
num = 3 + 4j
print(type(num))
# Output: <class 'complex'>
- It will print complex type because we used a character with a number for calculation.
2. Sequence Types
Sequence types are important parts in programming because it’s store collections of items in an ordered manner. Python provides multiple types of collections, such as:
a. Strings (str)
A string refers to a sequence of characters and it specify by single, double, or triple quotes. For Example:
message = "Hello, Python!"
print(type(message))
# Output: <class 'str'>
b. Lists (list)
Lists represent data in ordered and mutable collections. They can store elements of different data types. Remember one thing, the list is always written in Square brackets. For example:
fruits = ["apple", "banana", "cherry"]
print(type(fruits))
# Output: <class 'list'>
- You can see the type of fruit is ‘list’ because it contains a whole list of fruits. Read More…
c. Tuples (tuple)
Tuples are also stored in an ordered and immutable collection of items.
Example:
coordinates = (10, 20, 30)
print(type(coordinates))
# Output: <class 'tuple'>
- Tuples are represented in round brackets. Read More…
d. Ranges (range)
Ranges refer to an object, which means the variable contains a range of objects that represent a series of numbers, like 1 to 9, and we can use this type in loops.
For example:
nums = range(1, 10)
print(type(nums))
# Output: <class 'range'>
- In the above code, we added the range keyword with a range of numbers.
If you want to see all numbers inside the range, just write this code:
nums = range(5)
print(list(nums))
#output: [0, 1, 2, 3, 4]
If you want to print of number so you can write the code like the following structure:
nums = range(1, 5)
print(list(nums))
#output: [1, 2, 3, 4]
3. Mapping Types
Mapping types contain a Dictionaries (dict) that stores data in key-value pairs, and the key must be unique and immutable.
For example:
person = {"name": "John", "age": 45}
print(type(person))
# Output: <class 'dict'>
4. Set Types
Set types are useful to store multiple unique values in a single variable. These methods are mainly used when you want to avoid duplicate values and check if an item exists or not.
a) Sets (set)
This is the normal set that is unordered and changeable (mutable). For example:
unique_numbers = {1, 2, 3, 4, 5}
print(type(unique_numbers))
# Output: <class 'set'>
- Set types help us to store multiple items without duplicates, and Python automatically removes repeated values and keeps unique elements.
b) Frozen Sets (frozenset)
A frozen set is the mixed version of the set that cannot be changed (immutable). For example:
immutable_set = frozenset([1, 2, 3])
print(type(immutable_set))
# Output: <class 'frozenset'>
5. Boolean Type
The Boolean type represents a truth value such as True or False. This method is useful for decision-making in real-world programs.
Booleans help Python to understand whether something is correct, incorrect, matches, or doesn’t match. Read More…
is_active = True
print(type(is_active))
# Output: <class 'bool'>
6. None Type
The None type means absence of value. That means Python uses None where there is no value has been assigned yet, or the function does not return anything.
data = None
print(type(data))
# Output: <class 'NoneType'>
Simple code example:
x = None
print(x)
#output: None
- We can use None when a variable has no value yet. For example:
result = None
- We can also use None when a function returns nothing
def greet():
print("Hello")
print(greet())
Output:
#output:
Hello
None
- This is useful because the function prints something but returns nothing, so Python shows None.
data = 10
data = None
Type Conversion in Python
Type Conversion (also called Typecasting) means changing the data type of a value into another data type.
For example:
# Convert integer to string
num = 10
str_num = str(num)
print(type(str_num)) # Output: <class 'str'>
# Convert string to float
price = "19.99"
float_price = float(price)
print(type(float_price)) # Output: <class 'float'>
Learn Advanced Topics About Python
- How to use If Else in Python?
- What is Data Types in Python?
- What is Casting in Python?
- How to use Tuples in Python?
- Variables in Python Programming

M.Sc. (Information Technology). I explain AI, AGI, Programming and future technologies in simple language. Founder of BoxOfLearn.com.