QuestenaPráctica que te muestra qué repasar después
Pregunta 72

What is the value of [count * 2 for count in [1, 2, 3, 4] if count % 2 == 0]?

  1. [2, 4]
  2. [1, 2, 3, 4]
  3. [2, 6]
  4. [4, 8]Respuesta correcta

Explicación

The filter admits the even inputs 2 and 4, and the expression doubles each admitted value to build the result. A list comprehension creates a new list rather than modifying the input list or returning a generator object.

Continúa con este test

Empezar la práctica
Pregunta 72: What is the value of [count * 2 for count in [1, 2, 3, 4]… · Python Fundamentals · Questena