From 8b64f3ef505949af867fa4b96cc462b1662f976b Mon Sep 17 00:00:00 2001 From: Pravesh <cb.en.u4cse16234@cb.students.amrita.edu> Date: Wed, 19 Dec 2018 12:24:46 +0530 Subject: [PATCH] Upload New File --- CSE16234_ex3_q2.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 CSE16234_ex3_q2.py diff --git a/CSE16234_ex3_q2.py b/CSE16234_ex3_q2.py new file mode 100644 index 0000000..3d577bb --- /dev/null +++ b/CSE16234_ex3_q2.py @@ -0,0 +1,15 @@ +path='/home/student4/sun.txt' +sun_file=open(path,'r') +categories = {} +line = sun_file.readline().strip().split("/sun_") +category = line[0][3:] +while len(category)>0: + if category in categories.keys(): + categories[category]+=1 + else: + categories[category]=1 + line = sun_file.readline().strip().split("/sun_") + category = line[0][3:] + +print(categories) + -- GitLab