Question: Assignment # 13: Finding and Counting Unique Words in Python Create and save a file containing the well-known pangram, The quick brown fox jumps over

Assignment # 13: Finding and Counting Unique Words in Python

Create and save a file containing the well-known pangram, The quick brown fox jumps over the lazy dog. You may use a file that has more words and chapters but it will take a long time to process, so start with saving this sentence in a file.

We wish to determine how many unique words there are in this file as an estimate of the richness of writing vocabulary.

Dividing the number of unique words by the total number of words and multiplying by 100 yields the percentage of unique words in the file.

Use a dictionary to determine how many unique words are contained in the file.

Use .lower() to avoid counting capitalized words.

Use .translate(None, '!@#$%^&*()-|:;",.?/_|~`[]{}+=') to remove punctuation, except apostrophes.

After creating your dictionary, count your keys (unique words)

Calculate and print the percentage of unique words in the file.

Remember to use good programming style and formatted output.

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!