Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Median by pandayue
def checkio(data):
#replace this for solution
dl = len(data)
sortedData = sorted(data)
if dl%2 == 1:
#grab the center value
return sortedData[int((dl-1)/2)]
else:
return 0.5*(sortedData[int(dl/2-1)] + sortedData[int(dl/2)])
#These "asserts" using only for self-checking and not necessary for auto-testing
May 9, 2014