From 1d4ca9de0e237307821b1120fe9453abf720854c Mon Sep 17 00:00:00 2001 From: nixen420 Date: Mon, 26 Jun 2017 10:51:38 +0000 Subject: [PATCH] Done --- count_word.py | 14 ++++++++++++++ count_word.pyc | Bin 0 -> 599 bytes tests/__init__.pyc | Bin 0 -> 160 bytes tests/test_countWord.pyc | Bin 0 -> 1222 bytes 4 files changed, 14 insertions(+) create mode 100644 count_word.pyc create mode 100644 tests/__init__.pyc create mode 100644 tests/test_countWord.pyc diff --git a/count_word.py b/count_word.py index e69de29..4f1e972 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,14 @@ +def countWord(filepath,word): + file1=open(filepath,"r") + count = 0 + line=file1.readline() + while (line != ""): + words = line.split() + for i in words: + if i == word: + count += 1 + line=file1.readline() + + + file1.close() + return count diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000000000000000000000000000000000000..318b5e161c040f3f3b8522787e853878229ec6e9 GIT binary patch literal 599 zcmb_Z%SyvQ6g`tkwU!oj;|*A~)l7>;Ca=98s__Lo-hF-m literal 0 HcmV?d00001 diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d601bfa83ad70d3ca55e6858f94889b073ae16d GIT binary patch literal 160 zcmZSn%*&;<(=1hw2ylC%>+CuU zKIaW1IkF@s5AL8f^(dM+8YyEsSY51rEb|j$E;(aP(j|R`q!-YA&T8q=l}8JrbC2^{ zcx+j@d(Q1|xc$}*xKFl2*%mDYzv4uFq>k;<#enK>B!u9QJwj@0jCu}8-$A}_K(@KA z97FAFSn*?j6mcbz8HyHV&q|o`(h~WVcmhX9elnDajcR`#<43<99KGPN~jT!?wa{OqaUsA zfZ?L{#8JRk%w5t(6_yi=U?9s$N$!$yZE-ztU33xt15?N8MO&YjJQ;?mkHiE25BupA ALjV8( literal 0 HcmV?d00001