From 574d63acc675fbac1dc9205aae54def58c5193e8 Mon Sep 17 00:00:00 2001 From: sandiprb Date: Thu, 10 Aug 2017 18:36:44 +0000 Subject: [PATCH] Done --- count_word.py | 13 +++++++++++++ count_word.pyc | Bin 0 -> 697 bytes tests/__init__.pyc | Bin 0 -> 149 bytes tests/test_countWord.pyc | Bin 0 -> 1189 bytes 4 files changed, 13 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..eb99ae7 100644 --- a/count_word.py +++ b/count_word.py @@ -0,0 +1,13 @@ +from collections import Counter + +def countWord(filename, word_a): + counts = {} + words_list = [] + + with open(filename, 'r') as f: + for line in f: + for word in line.split(' '): + words_list.append(word) + + counts = Counter(words_list) + return counts[word_a] diff --git a/count_word.pyc b/count_word.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a015ee127a6758555e24b6fb7152a052ef56bf2e GIT binary patch literal 697 zcmbtRO>fjN5Pf!bQ(AVVsvso9g#$>r?53A;fC`X6f>R~h!$Kt#h1dnRNu0*B>Q>60 z%CS=a1^hsM0L++5`~WOx^87qsZ=C#^ZvFUq{i(w3O8Ebpzwn%m;jK^ujl!{lG8*53 zV-1_YBskOPpTTOF5zH7@8t>k>9FpQF+u(5bn^&e7ksROnWlOfNG-Em65stsmv2nm! z<15<)1Prk~goN5fIQ0n{z7Uxf~ zSg?W*A1RSr=DEVaTjAkRCPEKLn(L!|oQ)Wh7~k2J#tcGNJED|P*)eAh86ip|Y5v63 zwk;bQJuZB2iZa4Vga+DT7hywDyFjtXNz7ln)bQkCi*HB}GPBRx^E^P*@< z*A_*%&kplkgoK=IAVG6lQIv0%O>=qhcP@9?vGR3oD{{UKaT149CU5h}9E#$fn27#Y Xkqmji@n%`um-13Uo?=^XPA2LPQka*h literal 0 HcmV?d00001 diff --git a/tests/__init__.pyc b/tests/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51201221b1aabba937095785b9fce7030ade3b9d GIT binary patch literal 149 zcmZSn%*z$CpeHh!0SXv_v;z0N#vAlMjH%JK33io_%j-?Ee}L-hBUdp3>i+kN+oF_82C^qo^P%6-^Z> z_B|>*Dt(&zRCZ|Ep|VTUF3x5urb3^PU5#a8usQOWi8YyEsSY50mEc+8?p;N1d6s)Nx(97*PF{lv13sN07F`n1_J$1@dDHvdeYl z9A