Question: - Sample Run 1 - - - - - Enter one line of words at a time, Enter a blank line to stop Enter line:

- Sample Run 1
----- Enter one line of words at a time, Enter a blank line to stop
Enter line: It was the best of times it was the worst of times
Enter line: it was the age of wisdom it was the age of foolishness
Enter line: it was the epoch of belief it was the epoch of incredulity
Enter line: it was the season of Light it was the season of Darkness
Enter line: it was the spring of hope it was the winter of despair
Enter line: we had everything before us we had nothing before us
Enter line: we were all going direct to Heaven we were all going direct the other way
Enter line: in short
Enter line: the period was so far like the present period that some of its noisiest authorities insisted on its being re
ceived
Enter line: for good or for evil in the superlative degree of comparison only.
Enter line:
There were 10 lines containing 119 words
There was an average of 4.00 characters per word
- Sample Run 2
```
----- Enter one line of words at a time, Enter a blank line to stop -----
Enter line: Call me Ishmael
Enter line: Some years ago
Enter line: never mind how long precisely
Enter line: having little or no money in my purse
Enter line: and nothing particular to interest me on shore
Enter line: I thought I would sail about a little and see the watery part of the world
Enter line: It is a way I have of driving off the spleen
Enter line: and regulating the circulation
Enter line: Whenever I find myself growing grim about the mouth
Enter line: whenever it is a damp
Enter line: drizzly November in my soul
Enter line: whenever I find myself involuntarily pausing before coffin warehouses
Enter line: and bringing up the rear of every funeral I meet
Enter line: and especially whenever my hypos get such an upper hand of me
Enter line: that it requires a strong moral principle to prevent me from deliberately stepping into the street
Enter line: and methodically knocking people's hats off
Enter line: then
Enter line: I account it high time to get to sea as soon as I can
Enter line: This is my substitute for pistol and ball
Enter line: With a philosophical flourish Cato throws himself upon his sword
Enter line: I quietly take to the ship
Enter line: There is nothing surprising in this
Enter line: If they but knew it
Enter line: almost all men in their degree
Enter line: some time or other
``````
Enter line: With a philosophical flourish Cato throws himself upon his sword
Enter line: I quietly take to the ship
Enter line: There is nothing surprising in this
Enter line: If they but knew it
Enter line: almost all men in their degree
Enter line: some time or other
Enter line: cherish very nearly the same feelings towards the ocean with me
Enter line:
There were 26 lines containing 201 words
There was an average of 4.40 characters per word
```
- Sample Run 3
```
----- Enter one line of words at a time, Enter a blank line to stop
Enter line: Once upon a midnight dreary
Enter line: as I pondered weak and weary
Enter line: Over many a quaint and curious volume of forgotten lore
Enter line: While I nodded
Enter line: nearly napping
Enter line: suddenly there came a tapping
Enter line: As of someone gently rapping
Enter line: rapping at my chamber door
Enter line:
There were 8 lines containing 41 words
There was an average of 4.59 characters per word
```
- Sample Run 4
----- Enter one line of words at a time, Enter a blank line to stop
Enter line:
There were 0 lines containing 0 words
There was an average of 0.00 characters per word
(18 points) Test cases
- Fill these out before you write the program! As usual, put them in a comment at the bottom of your program file. Use a calculator to figure these. In the Lines input column, the commas represent pressing the Enter key, the Enter also represents pressing the Enter key.
10 points) Design
- As usual, 3 P's for your program!
- There are (at least) two different ways to design this program. It's your call which you do. DOCUMENT your choice!
1. Process the strings of input as you get them. In the sentinel logic loop, just do the splitting of the string and counting and totaling within the loop. You don't need to store the original input string after that. When the loop is finished (the user hits Enter), you are ready to output results and calculate the average.
2. Accumulate the strings of input into one big string in the sentinel logic loop. After the loop is finished (the user hits Enter), you can do one split and another loop to traverse the list that split generated.
- Another design decision is which kind of traversal you will use, either the "for item in list" or "for i in range(len(list))" Either will work here.
- Sample Run 1 - - - - - Enter one line of words

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!