diff --git a/count_word.py b/count_word.py index e69de29..eb99ae7 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,13 @@ +from collections import Counter + +def countWord(filename, word_a): + counts = {} + words_list = [] + + with open(filename, 'r') as f: + for line in f: + for word in line.split(' '): + words_list.append(word) + + counts = Counter(words_list) + return counts[word_a] diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..a015ee1 Binary files /dev/null and b/count_word.pyc differ diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000..5120122 Binary files /dev/null and b/tests/__init__.pyc differ diff --git a/tests/test_countWord.pyc b/tests/test_countWord.pyc new file mode 100644 index 0000000..66516f0 Binary files /dev/null and b/tests/test_countWord.pyc differ