Mean, median, and mode

Steven Bethard steven.bethard at gmail.com
Mon Dec 6 17:30:52 EST 2004


Paul Rubin wrote:
> median = x.sorted()[len(x)//2]

In Python 2.4:

 >>> [10, 8, 6, 4, 2, 1].sorted()
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
AttributeError: 'list' object has no attribute 'sorted'

Perhaps you meant "sorted(x)"?

Steve



More information about the Python-list mailing list