Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
MedianFinder solution in Clear category for Median by bai.marshmillo
def checkio(data):
data.sort()
numberInList = len(data)
#even number
if numberInList%2 == 0:
middleNumber1 = int(numberInList/2)
middleNumber2 = int(numberInList/2) - 1
median = (data[middleNumber1] + data[middleNumber2])/2
#odd number
else:
middleNumber = int((numberInList-1)/2)
median = data[middleNumber]
return median
June 19, 2015