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.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad