[Tutor] Aaagh! Stack arrays!?! calc average
john at fouhy.net
Wed May 2 01:14:02 CEST 2007
On 02/05/07, John Washakie <washakie at gmail.com> wrote:
> It aint pretty! And if I had just walked away, it probably would've
> taken half the time in the morning, but here's what I've come up with
> (any suggestions for improvements, or course are welcome):
I'm still not sure exactly what you want to achieve...
You're starting with a list of lists of integers, correct? Are the
interior lists all the same length?
Do you want to produce a new list which contains the average of all
the sublists? In this case, you can do that using the sum() and len()
functions -- check Ben's reply. A list comprehension would work well
here (see the tutorial on python.org for information on list
Is there anything else you want to do?
More information about the Tutor