Python Dictionary

Python Dictionary

Python Dictionary allows us to store key:value pairs. The order of these key:value pairs in a Python Dictionary is not saved, since the purpose of a Python Dictionary does not require this index to be saved.

Example of a dictionary

The following is a simple example for a dictionary.

myDictionary = {
    "apple": 34,
    "banana": 16,
    "cherry": 8
}
Run

In this dictionary, "apple", "banana", and "cherry" are keys, and 34, 16, and 8 are their respective values. their corresponding values, thus forming key:value pairs.

Summary

In this tutorial of Python Examples, we learned different Dictionary Operations with the help of well detailed examples.