Question: Write a function named inputStats that takes an input file name and an output file name as parameters. Your function reports various statistics about the

Write a function named inputStats that takes an input file name and an output file name as parameters. Your function reports various statistics about the file's text. In particular, your function should report the number of lines in the file, the longest line, the number of tokens on each line, and the length of the longest token on each line.

the text file:

"Beware the Jabberwock, my son,

the jaws that bite, the claws that catch,

Beware the JubJub bird and shun

the frumious bandersnatch."

the output:

Line 1 has 5 tokens (longest = 11

) Line 2 has 8 tokens (longest = 6)

Line 3 has 6 tokens (longest = 6)

Line 4 has 3 tokens (longest = 14)

Longest line: the jaws that bite, the claws that catch,

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!