diff --git a/count_word.py b/count_word.py index e69de29..eaa477c 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,9 @@ +def countWord(filepath, word): + k = 0 + with open(filepath) as f: + for line in f: + words = line.split() + for i in words: + if i == word: + k += 1 + return k diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..c6b4f4f 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..6c2aaa7 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..697884e Binary files /dev/null and b/tests/test_countWord.pyc differ