PythonCookAll activities
Tier 0 · Predict the output

What does the loop total?

Predict the output

Read the code and type what it prints.

1nums = [1, 2, 3]
2total = 0
3for n in nums:
4 total += n
5print(total)