0
See my qes. Plzz
x={5:1,4:2,33,2:4,1:5} print(x[4]) Ans: 2 Why?
3 ответов
+ 7
because thats a dictionary.
it doesnt use index, it uses key:value pairs.
x[4] means "look for the value at dictionary key 4"
which, when you look, 4 is 2 in that dictionary and is also why numbers are not usually used as keys
+ 4
This is a dictionary and so it is of key-value pairs.When you refer with the key name the equivalent value is printed.
In your case when you give x[4], the the number 4 is taken as the key and its equivalent value-2 is returned.
+ 2
Thnkuu guys