adplus-dvertising
frame-decoration

Question

What is the output of the code shown below?
l1=[1,2,3]
l2=[4,5,6]
[x*y for x in l1 for y in l2]

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]

Posted under Python

Answer: (c).[4, 5, 6, 8, 10, 12, 12, 15, 18]

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the code shown below?