Contact: aviboots(AT)netvision.net.il
39,900 questions
51,831 answers
573 users
def median(lst): half = len(lst) // 2 lst.sort() if not len(lst) % 2: return (lst[half - 1] + lst[half]) / 2.0 return lst[half] lst = [1, 7, 12, 5, 8, 9, 8] print(median(lst)) ''' run: 8 '''