filename = "one.txt"
s = open(filename).read().split()
f = {}
for word in s:
if word in f:
f[word] +=1
else:
f[word] = 1
s = [(one, f[one]) for one in sorted(f, key = f.get, reverse = True)]
for i in range(10):
print(s[i][0],":", s[i][1])
''' OUTPUT
King : 3
Once : 1
there : 1
lived : 1
a : 1
went : 1
for : 1
fishing : 1
and : 1
has : 1
'''
use python 019/Lab3.pdf python Exercise 2 Find out most common words in the book omma lane...