Index summation in Python

how to do a sum in the list, for example [3,0,1,-2,] return [3,3,4,2], adding index by index

What I have tried:

list = [3,0,1,-2]
total = 0
for i in list:
total = total + i

print(lista)

You are not wanting to sum the indexes. You are wanting to sum the list items.

The print statement should be printing a list not the running sum (what your total is doing).

There are a couple of approaches here. One is you can use total like you are doing but also append the total each iteration to lista.