-
-
Save amankharwal/f72d45f7776ba19ce15201a0d94a1b8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
words = [] | |
with open("aman.txt", "r") as f: | |
for line in f: | |
words.extend(line.split()) | |
from collections import Counter | |
counts = Counter(words) | |
top5 = counts.most_common(5) | |
print(top5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment