Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Median by virzen
import math
def checkio(data):
length = len(data)
sortedNums = sorted(data)
medianIndex = math.floor(length / 2)
return sortedNums[medianIndex] if length % 2 == 1 else (sortedNums[medianIndex - 1] + sortedNums[medianIndex]) / 2
Jan. 8, 2017