I have a list of 248 values that looks like this: lst = [10.0, 7.4, 8.2, 8.8, 7.4,.... ] I want to get the average of every 8 value. Such as it will be divided to 31 sub lists and will have the average of every list.
This is what I have for now but I have to write this 31 times if I use this method. Can someone point me to an easier and more efficient way?
num1 = 0
for i in range (8):
num += float(lst[i])
print(num1/8)
num2 = 0
for i in range (8, 16):
num += float(lst[i])
print(num2/8)