Skip to content
Snippets Groups Projects
Commit d9fe11fe authored by aslesha's avatar aslesha
Browse files

lab3 q1

parent a70ed983
No related branches found
No related tags found
No related merge requests found
Pipeline #156 canceled
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();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment