I have a series of data and would like to perform the following opperation:
AA = [2, 4, 6, 8]
a = []
a = AA[0]
b = AA[1]
sum_1 = a+b
c = AA[2]
sum_2 = sum_1 + c
d = AA[3]
sum_3 = sum_2 + d
To make it more concise, I'd like to put it in a for loop
, but I can't figure out how.
The desired output for me will be the updated sum_3