Mean, median, and mode
peter at engcorp.com
Mon Dec 6 21:07:11 CET 2004
Michael Fuhr wrote:
> Josiah Carlson <jcarlson at uci.edu> writes:
>>"Robert Brewer" <fumanchu at amor.org> wrote:
>>>Josiah Carlson wrote:
>>>>median = lambda x: x.sort() or x[len(x)//2]
>>>That...is a really sneaky use of null return values. I like. :)
>>Thank you, I'm just using a paradigm (exploiting lambdas) that I picked
>>up while going through various functional programming modules.
> print median([1, 2, 3, 4, 5, 6])
> Shouldn't the median be 3.5?
According to http://en.wikipedia.org/wiki/Median you are correct.
More information about the Python-list