-
최빈값 구하기코테 준비/문자열, 내장함수 2022. 12. 7. 00:32
from collections import Counter t=int(input()) for i in range(t): n=int(input()) numbers=list(map(int,input().split())) count=Counter(numbers) a=count.most_common(1) print('#%d %d' %((i+1),a[0][0]))
count=Count(numbers)
count.most_common(1) 가장 많이 나오는 숫자 한개 출력
'코테 준비 > 문자열, 내장함수' 카테고리의 다른 글
11723. 집합 (set 원소 추가, 삭제) (0) 2022.12.27 최대공약수, 최소공배수 (0) 2022.12.07 아스키코드 변환 (0) 2022.12.07 문자열이 영어인지 아닌지 확인하기 (0) 2022.12.07 대문자 <-> 소문자 변경 (0) 2022.12.07