add a first try

This commit is contained in:
Andreas Zweili 2021-10-31 13:16:53 +01:00
parent 6a7a1cb8e5
commit 9bb348ff36
1 changed files with 11 additions and 2 deletions

View File

@ -1,2 +1,11 @@
def count_words(sentence):
pass
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