Question · Python course · Module 2: Data Structures

Comprehension with a Condition

What does [x for x in range(5) if x % 2 == 0] return?

Answer options

  • [1, 3]
  • [0, 2, 4]
  • [2, 4]
  • [0, 1, 2, 3, 4]
Show the answer

Correct answer:

  • [0, 2, 4]