How you declare a dictionary in python?


Can anyone tell me how do you declare a dictionary in python?



Dictionary in Python refers to the key-value pairs that are stored together. Below is the example of a dictionary.

dict = {'Name': 'Rohith', 'Age': 29, 'College': 'JNIT'}

print "dict['Name']: ", dict['Name']

print "dict['Age']: ", dict['Age']


The output will be:

dict[Name]: Rohith

dict[Age]: 29


If you want to unleash your potential in this competitive field, please visit the Python course page for more information, where you can find the Python tutorials and Python frequently asked interview questions and answers as well.


This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.