Count how many words there are in the .txt file.
Then, print the words ordered by frequency and alphabetically.
def count_words():
d = dict()
word_file = open('words.txt')
for line in word_file:
word = line.strip();
d = countwords(word,d)
return d
I'm not sure if I am doing this correctly. Hoping someone can help me out.
When I run the program, I receive:
>>>
>>>
It's a paragraph of a speech.