beginnerscenario7 min
How do lists and tuples differ?
How do lists and tuples differ, and when would you use each?
Expected Answer
Lists are mutable and suited for changing collections. Tuples are immutable and useful for fixed records or values that should not change.
Detailed Explanation
A practical answer should mention mutability, intent, readability, and how immutable structures can be safer for fixed data.
Common Follow-up Questions
- Can a tuple contain a mutable list?
- Which one would you use for coordinates?