$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #216

What is the output?

g = (i * i for i in range(3))
print(sum(g), sum(g))
  1. 5 5
  2. 5 0
  3. 0 5
  4. 3 3
A generator is consumed by the first sum; the second sees nothing and returns 0.
Play Problem Solving ▸