Home / Expert Answers / Computer Science / write-a-program-that-analyzes-charles-dickenss-tale-of-two-cities-your-program-should-scan-the-f-pa949

(Solved): Write a program that analyzes Charles Dickenss Tale of Two Cities. Your program should scan the f ...



Write a program that analyzes Charles Dickens’s Tale of Two Cities. Your program should scan the file twocities.txt and collect per-chapter statistics for the total number of paragraphs, commas, characters, and words, average word length, longest and shortest word, and the first and last ten words (sorted alphabetically). Each statistic should be stored in a list of dictionaries (i.e., each chapter is a dictionary of statistics). Also, add the chapter number and chapter name when extracting the data. When analyzing words in the chapter, standardize the case, remove punctuation, and exclude duplicates. The application should prompt the user to select a chapter, and the chosen chapter's statistics should be reported.

The output should look like this: 

What chapter would you like to report? 28

Statistics for Chapter XXII (The Sea Still Rises)

Paragraph Count: 36

Comma Count: 199

Character Count: 8977

Word Count: 2029

Average Word Length: 4.424346968950222

Shortest Word: a

Longest Word: congratulations

First 10 Words (Alphabetically): ['0592m', 'a', 'about', 'achieving', 'across', 'acted', 'action', 'actions', 'adjacent', 'after']

Last 10 Words (Alphabetically): ['wretch', 'wretched', 'wretchedest', 'wrongs', 'wrote', 'years', 'yet', 'yielded', 'you', 'young']



We have an Answer from Expert

View Expert Answer

Expert Answer


First
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe