wip commit

This commit is contained in:
Andreas Zweili 2021-10-31 20:23:19 +01:00
parent 9bb348ff36
commit 94b33542ef
1 changed files with 4 additions and 4 deletions

View File

@ -1,11 +1,11 @@
def count_words(input_sentence):
sentence = input_sentence.lower()
sentence = ' '.join(filter(str.isalnum, sentence))
# for character in blocked_characters:
# sentence = sentence.replace(character, " ")
words = sentence.split()
result = {}
for word in words:
counter = 0
if word in words:
counter += 1
result[word] = counter
result[word] = words.count(word)
return result