From 0313fc1d2b2c7e85b725923b83dd4c663d904426 Mon Sep 17 00:00:00 2001 From: aslesha <cb.en.u4cse16259@cb.students.amrita.edu> Date: Wed, 19 Dec 2018 12:16:31 +0530 Subject: [PATCH] Upload New File --- lab3/cse16259_e3_1.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lab3/cse16259_e3_1.py diff --git a/lab3/cse16259_e3_1.py b/lab3/cse16259_e3_1.py new file mode 100644 index 0000000..85d80c2 --- /dev/null +++ b/lab3/cse16259_e3_1.py @@ -0,0 +1,18 @@ +fname = input("Enter the name of the file:") +infile=open(fname,'a') +infile.write("append the sentences:") +infile = open(fname, 'r') +wordcount={} +lines = 0 +for word in infile.read().split(): + if word not in wordcount: + wordcount[word] = 1 + else: + wordcount[word] += 1 +print (word,wordcount) +infile.close(); + + + + + -- GitLab