What will be the output generated by the following snippet?
a=[5,10,15,20,25]
k=1
i=a[1]+1
j=a[2]+1
m=a[k+1]
print(i,j,m)
(i) 11 15 16
(ii) 11 16 15
(iii) 11 15 15
(iv) 16 11 15
i=a[1]+1 haia[1] means a name ki jo list hai uska 2nd element because list me element ki index 0 se start hoti hai so index 1 ka matlab 2nd index hoga2nd index par 10 likha haiso i=10+1=11 hogaj=a[2]+1 hai a[2] means 3rd element soj=15+1=16 hogam=a[k+1]k ki value 1 di hui hai som=a[1+1]m=a[2] means 3rd elementso m=15 hogaso final ans 11 16 15 yani b wala option sahi hai
No comments:
Post a Comment