diff --git a/count_word.py b/count_word.py index e69de29..88cded8 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,11 @@ +def countWord(filename,word): + count = 0 + f = open(filename,'r') + for line in f: + if word in line: + count+=1 + f.close() + return count + +# countWord("testfile.txt","industry") +# Output : 2 diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..34c23aa 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..25d9370 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..a46a64a Binary files /dev/null and b/tests/test_countWord.pyc differ