diff --git a/count_word.py b/count_word.py index e69de29..f2ee4c0 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,15 @@ +def countWord(filepath,word): + lines = open(filepath,'r') # open file to read + counter = 0 + + for line in lines: + words = line.split() + for i in words: + if (word == i): + counter += 1 + else: + counter += 0 + + return counter + +print countWord('/home/vinod-boga/Workspace/code/005-count-word/files/testfile.txt','dummy') diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000..e940daf 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..8542296 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..c3313fb Binary files /dev/null and b/tests/test_countWord.pyc differ