Python Dictionaries
Objective 3.3 covers dictionaries: a mapping from keys to values, where the keys must be hashable and the values need not be. Two facts in circulation are out of date - dictionaries have kept insertion order since Python 3.7, and `has_key()` has not existed since Python 2. The rest is a small method list plus one genuinely surprising result about which keys count as the same key.
Data Collections Guide 16 of 26 Beginner
- Python3.14.4
- OSUbuntu 26.04 LTS
- pip25.1.1
- TimeAbout 17 min
- Reviewed23 August 2026
Written against the versions above. **Insertion order has been guaranteed since Python 3.7** and was already true as an implementation detail in 3.6. Any material describing dictionaries as unordered, or using `d.has_key(k)`, is Python 2 or pre-3.7 and should be distrusted generally - see {{guide:python-314-versus-the-syllabus}}.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RUNNER01 | 192.168.0.27 | Ubuntu 26.04 LTS | Python 3.14.4 - the only machine this path needs | 2 Core | 4 GB | 50 GB |
Before you start
- guide 15 - keys must be hashable, and that is why.
- guide 11 - iterating a dictionary gives its keys.
-
The four operations
-
A key that is not there
-
The three views
-
Order, and what counts as the same key
-
The methods that change a dictionary
-
Other ways to build one
-
What the exam does with this objective