Python loops

I don’t really understand why:
total = 0
lit = [1, 2, 3, 4, 5, 6, 7, 9]

for li in lit:
total = total + li
print(total)

came out as:
1
3
6
10
15
21
28
37

What did you expect that? Based on the output, I would say you put your print() call within the (body of the) loop. If you only want the final result, print should be outside/after the function

oh ic why that came out as that

since the variable total is set up to 0, we’ll have 0+1 as our first output.
Then second output we’ll be our first output plus the value at second index in the variable lit…