Skip to main content
interactive•code tracing•python
0s
+20 XP

Trace Accumulator Loop State

Trace the evolution of variable total through each iteration of the loop. What is the final value printed?

python
total = 0
for i in range(3):
    total += i
print(total)
Exit to Challenges