Question: Create a Python program that takes a file full of words and puts them in a list and a dictionary to count how many uique

Create a Python program that takes a file full of words and puts them in a list and a dictionary to count how many uique words there are in the file. Like the exapmple below. Create a Python program that takes a file full of words and

(1) Reading and processing the file The first step should be to ask the user for the input file that they would like to have an infographic created for. Once the file has been selected, you can read in all of the lines and strip the newlines off of the ends. To get the words, all you have to do is split each line on whitespace. To accomplish this, just call splitO on each line string, with no argument. You can then append each individual word to a python list. You do not need to strip off punctuation from the words or normalize the cases. For example, if you input file had the following content: two forks one knife two glasses one platee one naptkin his glasses his knife The words list should have the following content after processing the file words C'two', 'forks.', "one, 'knife.', 'two', glasses.', \ one, "plate.', 'one "naptkin.', 'his,' 'glasses.', 'his', 'knife. ' (2) Counting words Once you have a list of all of the words from the file, you can count the occurrences. You should use a dictionary for this. Continuing from the example of the last step, the dictionary should have the following contents: word_counts 'two':2, one:3, 'forks.":1, 'knife.":2, glasses." :2, 'plate." :1, 'naptkin.' :1, 'his

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 Databases Questions!