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 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz