range, len, type, sum, enumerate, map, sorted, all, any

dict_items는 iterable이다. iterator가 아니다.

s = "banana"
freq = {}
for ch in s:
    freq[ch] = freq.get(ch, 0) + 1
# freq == {'b': 1, 'a': 3, 'n': 2}

top = sorted(freq.items(), key=lambda x: x[1], reverse=True)[0]
print(top)      # ('a', 3)

dict.get은 값이 없으면 기본값 0을 반환한다.

이게 매우 편리한거다.