Dictionaries also known as maps are data structures that are used a lot in different scenarios. The process of getting an element from a dictionary can be done using an element that is not part of the dictionary which results in an error.
For example, let us take this scenario where we have a dictionary that has an element with the key name
and another one with the element surname
. If we want to access it using another element, such as age
, we are going to see an error like the following:
my_dictonary = {"name": "Name", "surname": "Surname"}Continue reading
print(my_dictonary["age"])