Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Median by polettix
def checkio(data):
data.sort()
length = len(data)
if length % 2 > 0:
return data[int((length - 1) / 2)]
else:
half = int(length / 2)
return (data[half] + data[half - 1]) / 2
Aug. 12, 2015