
Learning outcomes
By the end of this chapter, you should be able to:- identify list, tuple, set, and dictionary
- explain mutable vs immutable types
- perform basic operations on each
List
Ordered, mutable collection.Tuple
Ordered, immutable collection.Set
Unordered collection of unique elements.Dictionary
Key-value mapping.Mutable vs immutable
- mutable: list, set, dictionary
- immutable: tuple, string, int, float, bool
Common operations
Exam-focused points
- list uses
[], tuple uses(), set uses{}without key-value pairs - dictionary keys must be unique
- sets do not preserve duplicates
Practice questions
- Create a list of 5 numbers and print max/min.
- Create a dictionary for a student with 4 fields.
- Convert list
[1, 2, 2, 3, 3, 3]into unique values using set.
