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)
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)
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.