Question: Python 3.6 Question 12 (2e points) Write a function named filestats. The function filestats takes two string parameters: inFile, the name of an input file

Python 3.6

Python 3.6 Question 12 (2e points) Write a function named filestats. The

Question 12 (2e points) Write a function named filestats. The function filestats takes two string parameters: inFile, the name of an input file and outFile, the name of an output file The function filestats should read and analyze the contents of the input file and write the statistics it compiles to the output file. The statistics you should compute about the input file are: the number of characters; the number of words; * the number of lines ? *the number of digits; *the number of punctuation marks Each statistic should be written to a separate line of the output file. (Hint: the string class contains constants named punctuation and digits.) For example, if the input file contains the following lines: Lord I'm one, Lord I 'm two, Lord I'm three, Lord I'm four, Lord I'm 500 miles from my home 50? miles, 500 miles, 500 miles, 500 miles Lord I'm five hundred miles from my home Then an output file with the following lines would be correct: characters 181 words 35 lines 4 digits 15 punctuation 15

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!