Problem Statement
Which statement best describes lists and tuples in Python?
Explanation
A list lets you add, remove, or replace items; a tuple does not. That is why lists are great for dynamic collections while tuples are good for fixed records.
Because tuples are immutable, they can be used as dictionary keys when they contain only hashable values. This property makes tuples a safe choice for representing coordinates or composite keys.
Code Solution
SolutionRead Only
t = (1,2,3) # t[0] = 9 # TypeError lst = [1,2,3]; lst[0] = 9
