Report Bug

Qus

What will be the output of the following Python code?

  A = [[1, 2, 3],       [4, 5, 6],       [7, 8, 9]]     [[col + 10 for col in row] for row in A]
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. [[11, 12, 13], [14, 15, 16], [17, 18, 19]]
B. Error
C. [11, 12, 13], [14, 15, 16], [17, 18, 19]
D. [11, 12, 13, 14, 15, 16, 17, 18, 19]


Solution
A. [[11, 12, 13], [14, 15, 16], [17, 18, 19]]



Explanation
The code shown above shows a list comprehension which adds 10 to each element of the matrix A and prints it row-wise. Hence the output of the code is: [[11, 12, 13], [14, 15, 16], [17, 18, 19]]
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