in Python by
Python has something called the dictionary. Explain using an example.

1 Answer

0 votes
A dictionary in Python programming language is an unordered collection of data values such as a map. Dictionary holds key:value pair. It helps in defining a one-to-one relationship between keys and values. Indexed by keys, a typical dictionary contains a pair of keys and corresponding values.

Let us take an example with three keys, namely Website, Language, and Offering. Their corresponding values are, Python, and Tutorials. The code for the example will be:


print dict[Website] #Prints

print dict[Language] #Prints Python

print dict[Offering] #Prints Tutorials

Related questions

0 votes
asked Sep 5, 2021 in Python by SakshiSharma
0 votes
asked Dec 19, 2019 in Python by sharadyadav1986