0
Why do i get an error? (Access the Dictionary data-type by way of its native index)
dictionary = { "fimble" :4, "Jack" : 13, "umbrella": 10, "bottles": 2, "pn": "Tgursday 11May17", 3:464 } print(dictionary[3]) # You can still access the dictionary by it's native index print(dictionary[dictionary[3]])
3 Answers
+ 6
print(dictionary [dictionary [3]])
print(dictionary[464]) #Value of key 3 is 464
error #Coz there is no such key 464
+ 1
Dictionary are not like lists. You can not access it values using index, but using keys.
+ 1
The first print works because there is a key that is 3 in the dictionary.