wordfreq

mail@pastecode.io avatar
unknown
python
2 years ago
300 B
1
Indexable
Never
st1 = 'Python is an interpreted high level language'
st2 = 'Python is easier than any to other language'
wordlist = (st1+' '+st2).split()
wordfreq = dict()
for word in set(wordlist):
    wordfreq.setdefault(wordlist.count(word), list())
    wordfreq[wordlist.count(word)].append(word)
print(wordfreq)