extend the word-count exercise

This commit is contained in:
Andreas Zweili 2021-11-01 19:36:39 +01:00
parent 10153c268e
commit 40fc4a37a2
1 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,8 @@
def count_words(input_sentence):
sentence = input_sentence.lower()
# blocked_characters = [',', '.', ';', ':']
# sentence = ''.join(item for item in sentence if item.isalnum())
blocked_characters = [',', '.', ';', ':', '_']
for character in blocked_characters:
sentence = sentence.replace(character, " ")
words = sentence.split()
result = {}