This commit is contained in:
2018-08-13 22:31:00 -04:00
commit 4d9a26aff5

19
count.py Normal file
View File

@@ -0,0 +1,19 @@
from collections import defaultdict
from string import ascii_lowercase
def count_words(string):
word_dict = defaultdict(int)
words = string.split(' ')
for word in words:
word = ''.join(char
for char in word.lower()
if char in ascii_lowercase + "'")
word_dict[word] += 1
return word_dict