From a3e54d6c7c799895852a85e8fa9e79a566233d50 Mon Sep 17 00:00:00 2001 From: Prannesh SathyaMoorthy <cb.en.u4cse16231@cb.students.amrita.edu> Date: Wed, 19 Dec 2018 13:01:06 +0530 Subject: [PATCH] Category Count Done --- cse16231_ex03_02.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cse16231_ex03_02.py diff --git a/cse16231_ex03_02.py b/cse16231_ex03_02.py new file mode 100644 index 0000000..30bb274 --- /dev/null +++ b/cse16231_ex03_02.py @@ -0,0 +1,12 @@ +dic = {} +with open('nw.txt') as f: + x = f.readline() + while x: + x=x[3:-26] + if x in dic: + dic[x] += 1 + else: + dic[x] = 1 + x = f.readline() + +print(dic) -- GitLab