Back Navigation Next Navigation Conceptual Review (page 37 of 55)

A python dictionary is a collection of items. Unlike other compound data types that only have a value as an element, a dictionary has a key: value pair. A python dictionary is similar to a dictionary of words. Each key in the dictionary maps to a value, allowing for efficient lookup, insertion, modification, and deletion operations.

1. Keys must be unique and immutable (e.g., strings, numbers, tuples).
2. Values can be any data type (e.g., strings, integers, lists, etc.).

NOTE: As of Python version 3.7, dictionaries are ordered. In Python 3.6 and earlier, dictionaries are unordered.

Dictionaries are created using curly brackets during assignment {}.

Dictionaries

The keys for each item are to the left of the ":" and the associated values are to the right of the ":". The items are separated by a comma.