Hi,

i am in a little bit of a confusion here... i have an array of FLOATS (about 7000 entries), all of them are floats, and i need to make an average of the entries, if i am not mistaken, the math for finding the average is :

average = (element + next element ) / Total of elements

so in my case, i need to

average = (element [0] + element [1] + element [3] etc... ) / len(array)

i was looking at the manual for python and the list comprehension seems to be way to go, but i don't understand how to setup the expression to make it work, the example in the book (Mapping Lists )

[elem*2 for elem in li]

would produce the result, where EACH element of the array is multiplied by 2, and this is not what i need,

could some one point me in a direction?

thanks !

Tweet This+ 1 thisPost To Linkedin