Python dictionary are the hash table type data. It arrangement are the two dimensional type or we can say each item contain two values ,one is key and another one is value corresponding to their key
Dictionary is the mutable data type
Each item in dictionary are separated by the comma(,) and enclosed in curly parentheses({}) and in each item key and their corresponding values are separated by colon (:)
Example :-
D1={1:'first',2:'second'}
D2={'one':'fisrt', 'two':'second'}Program:-
d1={1:'first',2:'second'}
d2={'one':'fisrt', 'two':'second'}
print(d1)
print(d1[1])
print(d2['two'])
print(len(d1),len(d2))Output-
{1: 'first', 2: 'second'}
first
second
2 2In this program we display the dictionary in different ways. Firstly we display the whole dictionary and then we display the value of key '1' and then further we display the length of the dictionary.