Python’s Mutable vs Immutable Types: What’s the Difference?
Mutable data types are another face of the built-in types in Python. The language provides a few useful mutable collection types that you can use in many situations. These types allow you to change the value of specific items without affecting the identity of the container object.
In the following sections, you’ll learn about lists, which are arguably the classic example of a mutable type in Python. To complete your tool kit of mutable types, you’ll learn about dictionaries and sets. Understanding the basics of these data types will help you decipher how mutability works under the hood.
Lists
Python lists are a classic example of a mutable data type. Like tuples, lists are sequences of arbitrary objects. In a list, however,