fo=open('/Users/Administrator/Desktop/news.txt','r') news=fo.read() fo.close() sep=''',.?!";:--''' for i in sep: news=news.replace(i,' ').lower() news=news.split() word=dict(zip()) for i in news: word[i]=news.count(i) words = ''' a an the in on to at and of is was are were i he she you your they us their our it or for be too do no that s so as but it's her we ''' p= words.split() for i in p: if i in word.keys(): del(word[i]) word=sorted(word.items(),key=lambda x:x[1],reverse= True) for i in range(10): print(word[i])