Answer Posted / chaitanya
Python's built-in data type is dictionary, which defines one-to-one relationships between keys and values.
Dictionaries consist of pairs of keys and their corresponding values.
Dictionaries are indexed by keys.
Dictionary is similar to associative array or hash table of other languages.
As following example explains further- India, Angel & Cartoon are keys & their corresponding values are Bharat, Mother Teresa & Mickey respectively.
>>> dict = {'India': 'Bharat', 'Angel': ‘Mother Teresa’, 'Cartoon': 'Mickey'}
>>>print dict[India]
Bharat
>>>print dict[Angel]
Mother Teresa
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is polymorphism in python with example?
How are classes created in python?
How to write a text from from another text file in python ?
What are the tools that help to find bugs or perform static analysis?
What is a module and package in python?
What is python written in?
Explain different ways to create an empty numpy array in python?
How do you break in python?
What is the purpose of not in operator?
How many arguments can the range() function take?
What is python package manager (pypm)?
Write a small code to explain repr() in python ?
List down some of the pdb commands for debugging python programs?
What are tuples and relation?
How many hours learn python?