Question: To start out with, your program needs to read in a list of words from a file called 'words.txt', which will be in the same

To start out with, your program needs to read in a list of words from a file called 'words.txt', which will be in the same directory as your program.This list of words will have one word per line.You must read them into a data structure so that they may be accessed later by your code to search for each one in the text.Remember that there will be a newline character at the end of each line that you must dispose of in order for matching to work properly.The length of the 'words.txt' file will be variable, so your program should not assume it is some fixed number of lines.You must also have another data structure that stores a number, which will be associated with each word, so that a running total of the number of times that word appears in the text can be kept.In the example file provided, 'words.txt' has three lines, so my test program made two lists, one with three strings (the words) and one with three integers (the counts for each word).You may use lists or dictionaries, however you would like, as long as the program functions correctly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!