Report Bug
Qus :

What will be the output of the following Python code?

a={}
a[2]=1
a[1]=[2,3,4]
print(a[1][1])

Qus

निम्नलिखित Python कोड का आउटपुट क्या होगा?

a={}
a[2]=1
a[1]=[2,3,4]
print(a[1][1])


A. [2,3,4]
B. 3
C. 2
D. An exception is thrown


Solution
B. 3



Explanation
Now, a={1:[2,3,4],2:1} . a[1][1] refers to second element having key 1.



Report Bug