Count words in reviews

Easydictionariesgetlower· 10 XP

Before building a word cloud from customer reviews, the team needs a count of each word.

Write a function word_counts(text) that returns a dictionary mapping each word (in lower case) to how many times it appears. Words are separated by spaces, and there's no punctuation to worry about.

How it's checked

Your code runs, then the check below runs and its printed output is compared with ours.

  • word_counts("Great app great price") returns {"great": 2, "app": 1, "price": 1}

Hints, the later steps and the answer come with Pro.

def word_counts(text):
    ...