Daily #4 · 2 October 2026
Three functions, one number Hard
What does this print?
funcs = [lambda: i for i in range(3)] print([f() for f in funcs])
Show the answer
A: [2, 2, 2]
Why: Each lambda looks up i when it is called, not when it is made. By then the loop has finished and i is 2 for all three. lambda i=i: i freezes the value at creation.