Python | List Comprehension Quiz | Question 9

Last Updated :
Discuss
Comments

What will the following list comprehension output?

matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
filtered = [row[1] for row in matrix if row[1] % 2 == 0]
 

[2, 5, 8]

[1, 4, 7]

[2, 4, 6, 8]

[1, 2, 3]

Share your thoughts in the comments