Sponsored Reserved space — layout preview until AdSense is connected
easy +10 pts

Word frequency

Counter over split words.

Implement `word_freq(text: str) -> dict[str, int]`. Split on whitespace; case-insensitive; strip punctuation from word edges.

Constraints

len(text) ≤ 10^5

Example

>>> word_freq("the cat sat on the mat")
{"the": 2, "cat": 1, "sat": 1, "on": 1, "mat": 1}
10 points ~10 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

text.lower().split(); strip punctuation with str.strip('.,!?').
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.
Sponsored Reserved space — layout preview until AdSense is connected