Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
A little too complex solution in Clear category for Median by ale1ster
def checkio(data):
(data_sorted, data_len, even_length) = (sorted(data), len(data),
1 - len(data)%2)
(slice_start, slice_end) = ((data_len - even_length)//2,
(data_len - even_length)//2 + 1 + even_length)
return sum(data_sorted[slice_start:slice_end])/(1 + even_length)
#These "asserts" using only for self-checking and not necessary for auto-testing
May 12, 2014
Comments: