What is Dictionary?

dicts = {'a':1, 'b':2, 'c':3

Dictionary in Python or hash table (hashmap) in other programming language is one of the data structures that is the most efficient to store and take value. They store each of value towards key that is creating couple value of key. (Key is a, b, c while value is 1, 2, 3)

Defining Dictionary?


Accessing Dictionary?


Untitled

Entry in Dictionary is shown in the list that has been determined. But it is irrelevant when it comes to take them. The dictionary elements cannot be accessed by numeric index.

print(sport_team['Minnesota'])
print(sport_team['Colorado'])

Note: In dictionary we can’t access the item with indexing. We can do that by actually calling the keys.

Dictionary Keys vs. List Indices