17
Question Question 17
What will be the result of the following code ?
d1 = {"abc":5,"def":6,"ghi":7}
print(d1[0])- abc
- 5
- {"abc":5}
- Error
Error
Reason — In Dictionaries, the elements are accessed through the keys defined in key:value pairs not by indexes, therefore the expression d1[0] will raise an error as "0" is no such key defined in d1.