More Emily Dickinson

Consider the following program that breaks a file into words: Codeboard.io Link

Can we make a program to create a list of unique words in the file? To count the unique words are in this file?

Step 1 – Unique word list

Write a loop to read each word from the file. Only add it to a list if it is not already in the list.

Step 2 – Number of unique words

Print out the size of the list.

Step 3 – Count occurences of each word

For each word can we store a list containing the word and the number of occurances? E.g. [[apple,3][tree,4][bike,1]]

Scroll to Top