Differentiate between mutable and immutable objects in Python language with example.

Python >   Fundamentals of Python >   Important Points about Python  

Short Question

234


Answer:

Ans. Every variable in Python holds an instance of an object. There are two types of objects in Python, Le 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 afterwards. However, its state can be changed if it is a mutable object.

For example, int, float, bool, string, unicode, tuple are immutable objects in Python. In simple words, an immutable object can't be changed after it is created. Lists, dictionaries and sets are mutable types.


This Particular section is dedicated to Question & Answer only. If you want learn more about Python. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.