logo

Question detail

In Python, what is the result of applying map(lambda x: x * 2, [1, 3, 5]) and converting the result to a list?

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

MCQ

Type

practice

Style

Topic

Writing functional programs

Exam-style question

Try this first

In Python, what is the result of applying map(lambda x: x * 2, [1, 3, 5]) and converting the result to a list?.

  1. A.[2, 6, 10]
  2. B.[1, 3, 5, 2, 6, 10]
  3. C.[3, 5, 7]
  4. D.10

Model answer

What a good answer should say

  • The result is [2, 6, 10].

Explanation

Why this works

map applies the given function to every element of the list. Each value is multiplied by 2, producing 2, 6 and 10.

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.