lst = [1, 3, 8, 2, 2, 4, 7, 9, 1, 2]
mid = len(lst) // 2
total = 0
ans = {}

for i in lst:
    total += i

for i in lst:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

lst.sort()

print(f"평균: {total / 10}")
print(f"중앙값: {lst[mid]}")
print(f"최빈값: {max(ans,key = ans.get)}")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: