백준 2108 파이썬 통계학
최빈값이 제일 어려웠다 Counter와 most_common()을 쓰니 금방 해결! import sys N = int(sys.stdin.readline()) X = [] for i in range(N): X.append(int(sys.stdin.readline())) X.sort() # 1. 산술평균 print(round(sum(X) / N)) # 2. 중앙값 print(X[(N-1)//2]) # 3. 최빈값 from collections import Counter M = Counter(X).most_common(2) if len(M) > 1: if M[0][1] == M[1][1] : print(M[1][0]) else: print(M[0][0]) else: print(X[0]) # 4. 범위 prin..