From 45a69744d8ec3e6b59242d6ef0838d2a129be702 Mon Sep 17 00:00:00 2001 From: arunabh15091989 Date: Fri, 23 Jun 2017 06:49:17 +0000 Subject: [PATCH] Done --- count_word.py | 12 ++++++++++++ count_word.pyc | Bin 0 -> 682 bytes tests/__init__.pyc | Bin 0 -> 167 bytes tests/test_countWord.pyc | Bin 0 -> 1243 bytes 4 files changed, 12 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..efa4a47 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,12 @@ +def countWord(filepath,searchtxt): + f = open(filepath,"U") + count = 0 + lines = f.readlines() + for line in lines: + line_lower = line.lower() + words = line_lower.split(' ') + for word in words: + word = word.replace('.','') + if word == searchtxt.lower(): + count += 1 + return count diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36a2f1ea4ba339b4a9f70b52637d15fdccd44291 GIT binary patch literal 682 zcmcIh-Add*7(J8yt#lCtd)>?2tf?1b7sLvBDIyhFEEGvIvrTrhnV6Zy6((2PH}GkE zo<2ffz%%25Ptat(lP}-jIUm#cH`@98a(S0w`v`u|Xl6u^z#rfT9f6xTVkGnMf!3p) z)66r$0xlG7BD4`Cu>%)jF0cXGF4haUE-rp%XnSxy%%hO#!}T%mKz6VZXa`t-gB!5! z80`>lh*8dq4MpX|F#-*v}j0Wqu++ o?25klC`Pnh;vV09aTWW5?|X!IN&iXLkR&HdEmx&F4YK%;SFY`oBLDyZ literal 0 HcmV?d00001 diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a962ddf8cc2a784902aa5f94573cd943bc45bb96 GIT binary patch literal 167 zcmZSn%*$o8+9xuZ0SXv_v;zDa`RJ4b5iX~eay=>Rw!5zQHuqk^dT+Q1|-B}A=f@-2hP$EdM z?osVg<5S{O6HpRRGoWMupHEUyDX0kOJJA)$eyDz}wZX{kF^*b%Ii%5~ey+@`v-)6Uuz7)_VwQWkatdlv|Bd#c;wh6SJV znvon?5+{$`kyheSeC*Q5853X)u=cUcPlyZ2jG3e(eF@St=svT$^61i|8PR8tdCfew z%-uuh_Ltm#?*`l_8&I)ASAt)0syyRKY)(bAiG zZUe|^aw!*9&c`(m^8_yl z{A(8R{6-iq@lYIveBs=c?Nnu%Ukn3T<|esk#x==x#P!rg_