Skip to content · ⁨본문 바로가기⁩

Letter frequencies · ⁨문자 빈도⁩

English

Letter frequencies

Return a dictionary that tells you how many times each character appears in a string. For "aab" that is {"a": 2, "b": 1}.

The handy move is freq.get(ch, 0) — it reads the current count for ch, or 0 if you haven't seen it yet. Add 1 and store it back.

한국어

문자 빈도

문자열에서 각 문자가 몇 번 나타나는지를 알려주는 사전을 반환합니다. "aab"에 대해서는 {"a": 2, "b": 1}입니다.

편리한 방법은 freq.get(ch, 0)입니다 — ch에 대한 현재 카운트를 읽거나, 아직 본 적이 없으면 0을 읽습니다. 1을 더하고 다시 저장하세요.

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP