extend the word-count exercise
This commit is contained in:
parent
10153c268e
commit
40fc4a37a2
|
@ -1,7 +1,8 @@
|
||||||
def count_words(input_sentence):
|
def count_words(input_sentence):
|
||||||
sentence = input_sentence.lower()
|
sentence = input_sentence.lower()
|
||||||
# blocked_characters = [',', '.', ';', ':']
|
blocked_characters = [',', '.', ';', ':', '_']
|
||||||
# sentence = ''.join(item for item in sentence if item.isalnum())
|
for character in blocked_characters:
|
||||||
|
sentence = sentence.replace(character, " ")
|
||||||
|
|
||||||
words = sentence.split()
|
words = sentence.split()
|
||||||
result = {}
|
result = {}
|
||||||
|
|
Loading…
Reference in New Issue