From 2ca09c8be54f3064a9bd3dc3a2120f7216ebb817 Mon Sep 17 00:00:00 2001 From: ramkrishan-sahu Date: Wed, 12 Jul 2017 13:12:34 +0000 Subject: [PATCH] Done --- count_word.py | 12 ++++++++++++ count_word.pyc | Bin 0 -> 603 bytes files/testfile.txt | 4 ++-- tests/__init__.pyc | Bin 0 -> 167 bytes tests/test_countWord.pyc | Bin 0 -> 1243 bytes 5 files changed, 14 insertions(+), 2 deletions(-) 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..e5f582f 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,12 @@ +def countWord(fname,word): + count = 0 + with open(fname, 'r') as f: + for line in f: + words = line.split() + for i in words: + lower_case = i.replace(".","") + if(lower_case == word): + count=count+1 + return count + +# countWord('testfile.txt','dummy') diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e4b5ed26a037844dca5d9d2d0ecffd71aa6f3d98 GIT binary patch literal 603 zcmcJLK}*9h7>3`p+nmFB*u{efJ@zt-2VsJUphp?#z^Ncw+RW9pO>HtZu|4VCAL}3R zO%VJAmV8gYd~cHPP5keE?|6T97vuL6{GTy&pGbgD;GT)VB=A^?ExL?N#yLa36OK0xEK7gi;^)c!;g+nwQ)E&HdNPHwMyS3Rs%^|Sx zP>oPiYGa4zzmDvfzV2Z zl36%cxeTi)UsS1{N5xP_^JO?y)k2r-9>yw>;Y=r54$C()SH&>WI(;s3`W+rorh!M> z?SQgDa`RJ4b5iXJE z%9zh{cOkUNCao@9Wpp+%tuEaV)=C$qX=LFt)4Eyf+!l_zVSuF#)4roF2F<@Sc zfGsO`-@C&Nci6cB56MMTZqZWkD=zeVid>JbcBuJALI@7oCs12s^ix0v9`a)Yvdwkn z7Z}*5LfQM!4w6Y#OPe_Kf_De*i$hxIajVq43b6C) zYtu-TvcuknVCcR!Zr^t)-eDLEA3XbvHh8SN1zT>dY}~6)ZC-m!r=K^iOnu`SbE0Mj zn5KbT|8tzzR;GSl_|O+V5N5;UQqC>r=Ap1iOV*R_OrEqx+P3ZnrQ1G^VI?o@TkMjl zQ8H;nyZWG&)Nb^|m#ZsUc2my- z069%A<=V>G*gXgmp%{ugVi;hFhhkSez`6%(H~)MivP|bnW|^;3mMK%VHPn