top of page

What is Mutable and Immutable Types in Python?

Updated: Feb 10, 2023

Everything in python is considered an object. There are two types of objects in python, mutable and immutable types.

  • mutable object state can be changed.

  • immutable object state cannot be changed.

Mutable types are list, dictionary, set

Immutable types are int, float, complex, bool, str, tuple, frozen_set

### output
 ['apples', 'grapes', 'mangoes', 'bananas']

Traceback (most recent call last):
  File "E:\Python-Samples\BASICS\", line 7, in <module>
    fruits[0] = 'bananas'
TypeError: 'tuple' object does not support item assignment 

Some examples on mutable types:
Some examples of immutable types:

There is no update or append method in immutable types:

Thanks for reading!!!
Your Rating and Review will be appreciated!!

104 views0 comments

Recent Posts

See All


Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page