Mean, median, and mode

Robert Brewer fumanchu at amor.org
Mon Dec 6 12:38:09 EST 2004


Josiah Carlson wrote:
> sean_mcilroy at yahoo.com (Sean McIlroy) wrote:
> > 
> > >>> median = lambda x: (max(x)-min(x))/2
> 
> That is /not/ the median in the general case.
> 
> median = lambda x: x.sort() or x[len(x)//2]

That...is a really sneaky use of null return values. I like. :)


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org



More information about the Python-list mailing list