+ 1
from itertools import accumulate, takewhile nums = list(accumulate(range(9)))
How? Explain- output: [0, 1, 3, 6, 10, 15, 21, 28, 36]
2 ответов
+ 3
The list consists of the accumulation.
list[0]=0
list[1]=0+1
list[2]=0+1+2=3
list[3]=-0+1+2+3=6
and the life goes on.
Hope that helped!
+ 1
Thanks!