KnowledgeBoat Logo

Computer Science

How is indexing of a dictionary different from that of a list or a string?

Python Dictionaries

CBSE

6 Likes

Answer

In lists or strings, the elements are accessed through their index where as in dictionaries, the elements are accessed through the keys defined in the key:value pairs. Moreover, lists and strings are ordered set of elements but dictionaries are unordered set of elements so its elements cannot be accessed as per specific order.

Answered By

4 Likes


Related Questions