Michael Fuhr wrote:
Josiah Carlson <[EMAIL PROTECTED]> writes:



"Robert Brewer" <[EMAIL PROTECTED]> 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])
4

Shouldn't the median be 3.5?

According to http://en.wikipedia.org/wiki/Median you are correct. -- http://mail.python.org/mailman/listinfo/python-list

Reply via email to