[checkio] Median
[checkio] Median def checkio(data): #replace this for solution #return data[0] data = sorted(data) m = len(data) mh = int(m/2) if m % 2 == 1: return data[mh] else: return (data[mh - 1] + data[mh])/2 #These "asserts" using only for self-checking and not necessary for auto-testing if __name__ == '__main__': assert checkio([1, 2, 3, 4, 5]) == 3, "Sorted list" assert checkio([3, 1, 2, 5, 3]) == 3, "..
2016. 4. 6.