Python Python Collections (2016, retired 2019) Dictionaries Word Count

I need help getting started with this challenge. Help please!

I need you to make a function named word_count. It should accept a single argument which will be a string. The function needs to return a dictionary. The keys in the dictionary will be each of the words in the string, lowercased. The values will be how many times that particular word appears in the string.
# E.g. word_count("I do not like it Sam I Am") gets back a dictionary like:
# {'i': 2, 'do': 1, 'it': 1, 'sam': 1, 'like': 1, 'not': 1, 'am': 1}
# Lowercase the string to make it easier.
def word_count():
    if word_count = 

1 Answer

Maciej Deliś
Maciej Deliś
4,890 Points

split() and lower() string to words
create empty dictionary
then loop for words
if word is in dictionary update value =+1
else add word to the dictionary with value 1