Python data engineering interview problem. Difficulty: beginner. Pattern: Dictionaries. About 10 minutes. Free to practice.
Count how many times each whitespace-separated word appears. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement word_frequency(text: str) -> dict counting whitespace-separated words.
Input: word_frequency('a b a') Output: {'a': 2, 'b': 1} Second 'a' increments the count.
Topics: lakebench, python, counting, strings.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Count how many times each whitespace-separated word appears.
Implement `word_frequency(text: str) -> dict` counting whitespace-separated words. Example: `"a b a"` → `{'a': 2, 'b': 1}`. Keep the harness.