![]() ![]() |
Conceptual Review (page 38 of 55) |
Dictionaries are mutable but cannot contain duplicate keys. Dictionary items are entered in key:value pairs, which means that they may be referred to by using the key name. We may do this using hard braces [] or get() with the keys. Note that with both of these methods, we enter the keys and not the index position. If a key is not found with the [] extraction method, we will get a Traceback error. If a key is not found with the get() method, python will return a None type, which is the equivalent of a null.
We may also change the value associated with a key.