Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this assignment, you will write a Python program that asks the user for a list of words, and then prints the shortest word,
In this assignment, you will write a Python program that asks the user for a list of words, and then prints the shortest word, the longest word, and the average length of the words. Here is a sample run of the program (note that user input is in black, and printing from the program is in blue): Python 3.6.5 Shell File Edit Shell Debug Options Window Help Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 b it (AMD64)] on win32 Type "copyright", "credits" or "license ()" for more information. >>> RESTART: U:\cislll\fall18\projects\proj5.py ================ ===== Enter a list of words, separated by spaces: apple carrot pineapple plum watermelon peach Shortest word: plum Longest word: watermelon Average word length: 6.50 >>> X =========== Ln: 10 Col: 4 Also, please note that the list of words entered by the user was typed WITHOUT hitting Enter until after the very last word. The word list was wrapped below to the second line automatically. Requirements Your project file should be named proj5.py. Your program should run the Python shell. If you haven't already, make sure you watch the lectures on Functions, Advanced Functions, Strings, and Strings (Continued), which walk through several examples that are similar to this assignment. Your project must include the following functions: get_shortest, which takes a list of words as a parameter, and returns the word in the list whose length is the shortest get_longest, which takes a list of words as a parameter, and returns the word in the list whose length is the longest get_average, which takes a list of words as a parameter, and returns the average length of those words . These functions should be written before the "main code" for the project. I recommend looking at the format of a bigger Python program with functions, like the Hangman program from Lecture 12 and 14. Here are additional tips/requirements for your program: You may assume that the user will correctly enter a list of words separated by spaces You should round the average word length to two decimal places when printing it (hint: use conversion specifiers) .
Step by Step Solution
★★★★★
3.41 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
listofwords rawinputType in four words separated by a space split Sort the words by the...Get Instant Access to Expert-Tailored 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