• + 0 comments

    n = int(input()) raw = input().split() x = [int(i) for i in raw]

    def mean(arr): return sum(arr)/len(arr)

    def median(arr): sorted_arr = sorted(arr) a = (len(arr)-1)//2 b = a + 1 return (sorted_arr[a]+sorted_arr[b])/2

    def mode(arr): sorted_arr = sorted(arr) sorted_set = list( set(sorted_arr)) occurances = {item : sorted_arr.count(item) for item in sorted_set} #in case there are multiple occurances of multiple items n_dept_occ = [] for key, value in occurances.items(): if max(occurances.values()) == 1: return min(occurances.keys()) elif value == max(occurances.values()): n_dept_occ.append(key) return min(n_dept_occ)

    print(mean(x)) print(median(x)) print(mode(x))