In Python a tuple is immutable object but allows mutation of a contained list? -
in python: >>> tup = (1,"a",[1,2,3]) >>> tup (1, 'a', [1, 2, 3]) >>> tup[2][1] = "a" >>> tup (1, 'a', [1, 'a', 3]) from above modify list contents part of tuple. since tuple immutable how possible? did understood immutable part in wrong way? you did understand immutable part wrong way. tuple indeed immutable, cannot change list: in [3]: tup[2] = [] --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-input-3-02255d491606> in <module>() ----> 1 tup[2] = [] typeerror: 'tuple' object not support item assignment the reference list immutable in tuple. however, list mutable, , hence can modified, know. in other words, tuple, immutable, contains 3 elements: integer 1 string "a" a reference list. you can imagine adress of list, if know c. if d...