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?.
- A.[2, 6, 10]
- B.[1, 3, 5, 2, 6, 10]
- C.[3, 5, 7]
- 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.
