Let\'s say I have a numpy array a containing 10 values. Just an example situation here, although I would like to repeat the same for an array with length 100.
a
You could use
import numpy as np a = np.array([1,2,3,4,5,6,7,8,9,10]) step = 5 for i in range(0,a.shape[0],step): print(np.sum(a[i:i+step]))