Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Median solution in Clear category for Median by mcoimbrac
def checkio(data):
data.sort()
#par: average value from two middle values
if (len(data) % 2 == 0):
position = int(len(data) / 2)
median = (float(data[position-1])+float(data[position])) / 2 #impar: just take the middle value
else: #impar
#position = int(len(data) / 2)
median = data[int(len(data) / 2)]
return median
#These "asserts" using only for self-checking and not necessary for auto-testing
May 3, 2014