Skip to main content
Submitted by admin on 27 December 2021

Data types are used to specify the type of data while storing. Every variable is associated with a data type.

Note: type()function is used to determine the type of data type.

1. Primitive Data Type( Built-in Datatype)

Primitive data types are referred to as in-built data types and are in the form of keyword for particular language.

Primitive data types are also immutable, meaning that they can not be changed after they are created.

There are 5 types of Primitive Data Type as listed below.
Integers, Floats, Strings, Booleans, NoneType, complex numbers
1. Integer (int):
This value is represented by int class. It contains positive or negative whole numbers (without fraction or decimal). In Python there is no limit to how long an integer value can be. type(100)
2. Float (float):
This value is represented by float class. It is a real number with floating point representation. It is specified by a decimal point. Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation. type(100.50)
3. String (str):
type("Hello world)
4. Boolean (bool):
type(True) OR type(False)
5. NoneType (None):
NoneType is a data type that represents the absence of a value or a null value. type(None)
6. Complex Numbers
Yes, complex numbers are a built-in data type in Python. Python supports complex numbers natively, allowing you to perform arithmetic operations and mathematical functions involving complex numbers. It is specified as (real part) + (imaginary part)j. For example – 2+3j
type(2+3j)

2. Non-primitive Data Type( user defined Datatype)

Non-primitive data types are also mutable, meaning that they can be changed after they are created.

As they are user-defined data types, there is no specific count. It may vary depending on the requirement because we also create your own custom. The most common usage is as below.
Lists, Tuples, Dictionaries, Sets or [your custom data type]