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
Why should we hire you examples?
Differentiate between deep and shallow copy?
What is break in python?
Can a constructor be static?
What is the keyword to import a module in python?
What are types in python?
What is a data structure in python?
Which is better Python or ruby?
Explain accessor and mutator methods in python?
Is python a high level language?
What does the meaning of gil in python language?
When you need ordered container of things, which will be manipulated, use lists?
What will be the output of data[-2] from the list data = [1,5,8,6,9,3,4]?
What is an f string in python?
What is string slicing in python?