python

Python 함수 정리 (계속 업뎃)

코딩마스터! 2021. 8. 30. 21:41

※  map

- map(함수, iterable)

: iterable 요소들을 함수들을 적용해서 바꿔줌.

 

- map(int, input().split())

 

※  Counter

 

: 딕셔너리 형태로 최빈값을 리턴해줌

 

[Input]

a = [1,1,2,3,3,4]

[Output]

Counter({1: 2, 3: 2, 2: 1, 4: 1})

 

-  Counter.most_common()

 

: 최빈값순으로 정렬하는 튜플 리스트 리턴함.

 

[Input]

a_list.most_common()

[Output]

[(1, 2), (3, 2), (2, 1), (4, 1)]