(1) Dictionary is an unordered collection of key-value pairs. It is generally used to operate on a huge amount of data. Dictionaries are optimized for retrieving data. We must know the key to retrieve the value. Dictionary key can be of almost any Python type but usually numbers or strings. Values, on the other hand, can be any arbitrary python object dictionaries enclosed by curly braces { }. The values are assigned and accessed by using square brackets [ ]. Dictionaries are mutable which implies that the contents of the dictionary can be changed after it has been created.
(2) Example of Python Dictionary:
Create Dictionary in Python as shown below.
Access value from the Dictionary by the use of a key as shown below.
Comments (No)