Dictionary is a useful container in Python. The items in the dictionary are in pairs. One is called Key, the other is called Value.
Remember the friend list? We want to store his age with the friend’s name. For him:
friends = {'Shuvo':15, 'Tuhin':13, 'Tanvir':14, 'Dipu':13, 'Siyam':14}
Above we have created a dictionary. In which what is the name of the friends and the value is their age. We can find out the type of the container above
friends = {'Shubo':15, 'Tuhin':13, 'Tanvir':14, 'Dipu':13, 'Siyam':14}
print ( type(friends) ) 
Which will give us the output <type ‘dict’>

Post a Comment

0 Comments