Skip to content
CodeKruPro

Read a list comprehension

QuizEasyPython onlyAsked in: Capgemini, Infosys, TCS

A list comprehension is a one-line way to build a list from a loop. What is [x * 2 for x in range(5) if x % 2 == 0]? (x % 2 == 0 is true when x is even.)

Choose one answer.

to answer and keep your progress. Reading is free for everyone.