Dictionary internals
A dict stores key/value pairs in a hash table, giving average O(1) lookup. Keys are unique and hashable; values are not. Use dict comprehensions to build them:
squares = {x: x * x for x in range(4)} # {0:0,1:1,2:4,3:9}
Insertion order is preserved in modern Python, so iteration is stable.