In Python, integers and strings are immutable types — once an integer or string object is created, its value cannot be changed in place; any operation that appears to modify it actually creates a new object. Lists and dictionaries, by contrast, are mutable — their contents can be changed after creation using operations like append(), remove(), or key assignment, without creating a new object.
Community Discussion