(Python programming) Design, code, and test a program that reads the text below as an input file. (First save this text to your system as a txt file, and put it in a folder where your program can find it or make sure you tell your program exactly where it can be found.)

As you process the file, do the following:

(1) Strip out all punctuation (including periods, apostrophes, quotation marks, commas, etc.).

(2) Count the words.

(3) Add up the total length of all the words.

(4) Calculate the average word length.

(5) Output the values you calculated in steps 2,3,4 above. Be sure to preface each value with info about what the number means (for example, "Total words in the file is 251.")

cr.txt

I went to the crossroad, fell down on my knees
I went to the crossroad, fell down on my knees
Asked the Lord above, "Have mercy, now, save poor Bob if you please"

Ooh, standin' at the crossroad, tried to flag a ride
Ooh-ee, I tried to flag a ride
Didn't nobody seem to know me, babe, everybody pass me by

Standin' at the crossroad, baby, risin' sun goin' down
Standin' at the crossroad, baby, eee-eee, risin' sun goin' down
I believe to my soul, now, poor Bob is sinkin' down

You can run, you can run, tell my friend Willie Brown
You can run, you can run, tell my friend Willie Brown
That I got the crossroad blues this mornin', Lord, babe, I'm sinkin' down

And I went to the crossroad, mama, I looked east and west
I went to the crossroad, baby, I looked East and West
Lord, I didn't have no sweet woman, ooh well, babe, in my distress

Q&A Education