Report Bug

Qus

What will be the output of the following Python code?

  l1=[1,2,3]  l2=[4,5,6]  [x*y for x in l1 for y in l2]
Qusनिम्नलिखित Python कोड का आउटपुट क्या होगा?


A. [4, 8, 12, 5, 10, 15, 6, 12, 18]
B. [4, 10, 18]
C. [4, 5, 6, 8, 10, 12, 12, 15, 18]
D. [18, 12, 6, 15, 10, 5, 12, 8, 4]


Solution
C. [4, 5, 6, 8, 10, 12, 12, 15, 18]



Explanation
The code shown above returns x*y, where x belongs to the list l1 and y belongs to the list l2. Therefore, the output is: [4, 5, 6, 8, 10, 12, 12, 15, 18].
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