Python supports various data types, including dictionaries. A dictionary in Python is a collection of elements that are stored as key-value pairs. It is an unordered data structure, and the indexing is done based on the keys assigned to each element. Let’s consider an example: we have a dictionary named ‘dict’ with two keys, ‘Country’ and ‘Capital’, which have corresponding values ‘India’ and ‘New Delhi’, respectively.
Syntax:
dict={‘Country’:’India’,’Capital’:’New Delhi’, }
Output: Country: India, Capital: New Delhi
Leave a Reply