By the end of this module you can do everything below. The objectives and their wording come from the official PCEP-30-03 syllabus.
3.2.1 Construct, access, and use tuples effectively
- Create empty, single-element, and multi-element tuples.
- Access tuple elements using positive and negative indexes, and extract portions of tuples using slicing.
- Explain tuple immutability and compare the characteristics and common use cases of tuples and lists.
- Create nested tuples and lists by storing one collection inside another.
- Access elements within nested tuples using appropriate indexing.
3.3.1 Collect and process unique values using sets
- Explain the defining characteristics of the
setdata type. - Create empty and populated sets.
- Explain why sets do not preserve positional indexing.
- Add elements to a set.
- Remove elements from a set using appropriate methods.
- Test membership using the
inandnot inoperators.