In Python, everything is treated as an object or instance of an object. So depending on the nature of the objects the instances behave. Accordingly, the nature of data types the data types are categorized into Mutable and Immutable data types.
Every variable in python holds an instance of an object. There are two types of objects in python i.e. Mutable and Immutable objects. Whenever an object is instantiated, it is assigned a unique object id. The type of the object is defined at the runtime and it can’t be changed afterward. However, it’s the state can be changed if it is a mutable object.
To summarise the difference, mutable objects can change their state or contents and immutable objects can’t change their state or content.
Data Types in Python
There are many data types in python we have discussed a few mostly used data types in this post as mention below table.
|float||Floating point number||Yes|
|list||The mutable sequence of objects|
|tuple||Immutable sequence of objects||Yes|
|str||unorder set of distinct objects|
|forzenset||Immutable form of set class||Yes|