say we have a l
list, it made up of 5 or more element which i want to calculate every nth sum in the list just like a fibonacci sequence
l=[1,5,6,7,2]
finally i would like to have a new list l2
which show the sum of every nth element in the l
list
1+5=6
5+6=11
6+7=13
7+2=9
l2=[0,6,11,13,9]
i have tried list2= [sum(l[i:i+i[2]])for i in range(0,len(l),2)]
but it says int not scriptable
and i try many more just to stuck please help