Python Dictionaries

Python Dictionaries

A dictionary is a collection which is unordered, changeable and indexed. In Python dictionaries are written with curly brackets, and they have keys and values.

Example:
dict = {‘Name’: ‘Zara’, ‘Age’: 7, ‘Class’: ‘First’}
print “dict[‘Name’]: “, dict[‘Name’]
print “dict[‘Age’]: “, dict[‘Age’]

When the above code is executed, it produces the following result

dict[‘Name’]: Zara
dict[‘Age’]: 7

Let’s Explore more about dictionaries through jupyter notebook.

Datasciencelovers