wip commit
This commit is contained in:
parent
9bb348ff36
commit
94b33542ef
|
@ -1,11 +1,11 @@
|
||||||
def count_words(input_sentence):
|
def count_words(input_sentence):
|
||||||
sentence = input_sentence.lower()
|
sentence = input_sentence.lower()
|
||||||
|
sentence = ' '.join(filter(str.isalnum, sentence))
|
||||||
|
# for character in blocked_characters:
|
||||||
|
# sentence = sentence.replace(character, " ")
|
||||||
words = sentence.split()
|
words = sentence.split()
|
||||||
result = {}
|
result = {}
|
||||||
for word in words:
|
for word in words:
|
||||||
counter = 0
|
result[word] = words.count(word)
|
||||||
if word in words:
|
|
||||||
counter += 1
|
|
||||||
result[word] = counter
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue