Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Task F: Statistics In this task yourl write a function that computes some basic statistics for the list of words in the book. - Choose
Task F: Statistics In this task yourl write a function that computes some basic statistics for the list of words in the book. - Choose a sensible name for the function - It should take a list of words (strings) as its input - It should retum, as a tuple: - the length of the shortest word (which should be 1, of course) - the length of the longest word (inyphenated words are OK) - the mean (average) length of the words (you can use stat istics. mean() for this if you like). - the median length of the words in the book (statistics.median() might be useful). Also, write a function that returns the longest word in a list (not the length, but the word itself). Output the key statistics for your two books, and the longest word. Maye sure to use the "new" versions of the books, with preamble and license information removed. For example your output might look like: statistics for AliceInwondertand-new.txt: Shortest word has length 1 Longest word has length 46 and is. "inportant-unimportant-uninportant-important-" Full list mean: 4.25; Full list median: 4 Unique 11 st mean: 6.61; Unique list median: 6.0 Show that you can use print() and f-strings. In particulaf, the mean should more reported to at most two decimal places
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started