I am following instructions for a class homework assignment and I am supposed to look up the top 200 most frequently used words in a text file.
Here\'s the last par
I am using python 3.5 and I meet the same problem of TypeError.
Using vocab = list(fdist1.keys()) does not give me the top 50 most frequently used words.
But fdist1.most_common(50) does.
Further,if you just want to show those top 50 words not with their frequency,you can try :
[word for (word, freq) in fdist1.most_common(50)]