Report Bug

Qus

What will be the output of the following Python code?

  l=[[1, 2, 3], [4, 5, 6]]  for i in range(len(l)):  	for j in range(len(l[i])):  		l[i][j]+=10  l
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. No output
B. Error
C. [[1, 2, 3], [4, 5, 6]]
D. [[11, 12, 13], [14, 15, 16]]


Solution
D. [[11, 12, 13], [14, 15, 16]]



Explanation
We use range twice if the shapes differ. Each element of list l is increased by 10. Hence the output is: [[11, 12, 13], [14, 15, 16]]
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