Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First - Median solution in Uncategorized category for Median by divided.hr
def checkio(data):
data_sorted = sorted(data)
data_len = len(data_sorted)
if len(data_sorted) % 2 == 0:
data1 = data_sorted[:data_len // 2]
data2 = data_sorted[data_len // 2:]
return ((max(data1) + min(data2)) / 2)
else:
return (data_sorted[(data_len-1) // 2])
June 23, 2015
Comments: