Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Median by light2happy.718
def checkio(data):
"""Return median."""
data.sort()
length = len(data)
mid_index = length // 2
if length % 2 == 1:
return data[mid_index]
else:
return (data[mid_index-1] + data[mid_index]) / 2.0
May 19, 2015
Comments: