Indexing of a dictionary is possible?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Indexing of a dictionary is possible??

I am not able to call the elements of the dictionary!!!!

21st Jun 2017, 7:04 PM
Robin sharma
Robin sharma - avatar
1 Answer
0
my_diction.keys() Dictionaries don't have an index number, unlike lists or strings. This is because they aren't in any specific order by nature. The elements are called using the unique keys. You either know what the name of the key is, and call for it. Or you iterate over each key using a loop, or the method I gave above.
21st Jun 2017, 7:16 PM
Sapphire