Question: Python Homework 7 Write a program that analyzes Charles Dickens's David Copperfield. Your program should scan the file copperfield.txt and provide per-chapter statistics for the

Python  Python Homework 7 Write a program that analyzes Charles Dickens's David

Homework 7 Write a program that analyzes Charles Dickens's David Copperfield. Your program should scan the file copperfield.txt and provide per-chapter statistics for the total number of commas, total number of words and average word length. In addition to these statisties, your program should report the longest and shortest word in each chapter. You should aso create a list of all words used in the chapter. Sort the list alphabetically and report the first 10 words in the list. Extra Credit in your list of words, check to see if the word is in the list before adding it. If it is in the list, add it. If is not in the list, do not add it Hint When checking for the longest and shortest word, you will need to compare each new word you encounter to the current longest/shortest word and update the current longest/shortest accordingly. For the ist of words, the list should contain individual words and not lines of words or lists of words Output Statistics for chapter 1 ( AM BORN) Total conmasi 456 Total words: 4653 Avezage word length: 4.4156458195011395 Shortest word: Longest wordi Really-really-as ,After All, A, And, Anyhow, Last 10 woeds: you, you1, yoyou. you.' you?", young, younger, your, yourselt, youthful Statist i e, tor chapter 2OBSERVE, Total connas: 574 Total vorda: 6246 Average word length: 4.23807236631444 Longest words oomplexion--posound Pizst 10 words: "Bewitching, Pretty, good, "precty"yes". (oE, of (the, (when, (which 1ast 10 wordai you, you'", you'd, you youth, youthful you, you?, you?", young, your, Statiat Lca tor chapter 63 A VISTOR) Total ccrmaa: 341 Total worda: 3210 Average word length: 4.210903424791277 tongest vord: honestest-helping Laet 10 words i yeth.. you. you!, you'd you.11, yo yos?.. rung, younger

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!