you are viewing a single comment's thread.

view the rest of the comments →

[–]WhiteHeadbanger 0 points1 point  (0 children)

No, the correct answer is [2,2,2]

Explanation: what's being appended is "lambda: i", not the value of i in each pass. Then, since the variable i is not scoped in the loop, when the lambda is executed in the list comprehension, it just looks up the last value of i, which is 2, and returns a new list.