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.4.1 Construct, modify, and process dictionary data
- Create empty and populated dictionaries containing key-value pairs.
- Access dictionary values using keys, and use the
inandnot inoperators to determine whether a key exists. - Add new key-value pairs and update values associated with existing keys.
- Remove key-value pairs.
- Iterate through dictionaries, including their keys, values, and key-value pairs using the
keys(),values(), anditems()methods.