exercism/python/word-count/word_count.py

12 lines
260 B
Python

def count_words(input_sentence):
sentence = input_sentence.lower()
words = sentence.split()
result = {}
for word in words:
counter = 0
if word in words:
counter += 1
result[word] = counter
return result