all problems

Word frequency counter

pythoneasydictsstrings

Write word_counts(text) that returns a dict mapping each lowercase word to how many times it appears. Split on whitespace.

hint ladder

solution.py
loading editor…
step inspector

Inspect a chained expression (df.query(…).groupby(…).agg(…)) to see the shape and preview after each step.

output

Run your code to see its output, or check your solution to grade it.

Reference solution

The shape we check against. Any implementation that passes the assertions is valid — this one favours clarity.

def word_counts(text):
    counts = {}
    for w in text.lower().split():
        counts[w] = counts.get(w, 0) + 1
    return counts

Code is blurred until you solve this problem — the reasoning stays readable.