Question: What did you find most challenging with this program? What problems did you encounter and how did you solve them? What did you learn from

What did you find most challenging with this program?
What problems did you encounter and how did you solve them?
What did you learn from writing this program?
Programming Challenge 8.6. Average Number of Words
In the Ch08 folder, project folder for Average Number of Words, you will find a file named text.txt. The text that is in the file is stored as one sentence per line. Write a program that reads the files contents and calculates the average number of words per sentence.
Algorithm
Read all the lines in the file into a list
Initialize an accumulator variable for total count of words in the
For each line
Split the line into words
Determine the number of words in the list
Add that count to the total count for words
Divide the total word count by the number of lines in the file to get the average number of words per sentence.

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 Programming Questions!