Mean, median, and mode

Josiah Carlson jcarlson at uci.edu
Mon Dec 6 12:29:04 EST 2004


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]

 - Josiah




More information about the Python-list mailing list