I got a list with 958 elements.
myList = [1, 2, 3, 4, ..., 958]
I want to take first 100 elements, then next 100 (from 100 to 200) and so on.
What I have tried:
sum = 0
ct = 0
for i in range(len(myList):
sum = sum + myList[i]
ct = ct + 1
if ct == 100:
ct = 0
print(sum)
sum = 0
It works good until the 900th element. Then it cannot do the sum of the last 58 elements of myList because the ct will not get 100.
Any ideas?