Question: Please program the following lab in Python 3 and please DO NOT use any complicated solutions. This is words.txt: (Copy and Paste this whole list

Please program the following lab in Python 3 and please DO NOT use any complicated solutions.Please program the following lab in Python 3 and please DO NOT

This is words.txt: (Copy and Paste this whole list using crtl+a) This is the link to the word list: http://greenteapress.com/thinkpython2/code/words.txt PLEASE DO NOT USE THE SOLUTION BELOW:

fin = open("words.txt") min1 = 0 max1 = 0 total = 0 flag = 0 count = 0 minWord = "" maxWord = "" for line in fin: if flag == 0: min1 = max1 = len(line) flag += 1 if len(line) > max1: max1 = len(line)-1 maxWord = line if len(line)

print("The longest words are %d characters; an example is %s" %(max1, maxWord)) print("The shortest words are %d characters; an example is %s" %(min1, minWord)) print("The average word length is %s" % avg)

I DO NOT WANT THIS SOLUTION ABOVE.

Thank you.

Create a program that reads words.txt (link near top of our home page) in order to: . Determine the length of the longest word(s) and output that length plus the first word of this length found. . Determine the length of the shortest word(s) and output that length plus the first word of this length found . Determine and output the average length of all the words in the list You should strip white space from each word before using its length in your calculations My solution's output is: The longest words are 21 characters; an example is counterdemonstrations The shortest words are 2 characters; an example is aa The average word length is 7.933511409466738

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!