QuestenaՎարժանք, որը ցույց է տալիս՝ ինչ կրկնել հաջորդիվ
Հարց 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]Ճիշտ պատասխան

Բացատրություն

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.

Շարունակեք այս թեստով

Սկսել վարժանքը
Հարց 72: What is the value of [count * 2 for count in [1, 2, 3, 4]… · Python Fundamentals · Questena