Daily #15 · 13 October 2026
Summing it twice Medium
What does this print?
squares = (n * n for n in range(4)) print(sum(squares), sum(squares))
Show the answer
B: 14 0
Why: A generator produces its values once and is then used up. The second sum finds nothing left and returns 0. Use a list if you need to go through the values more than once.