Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python 3.6 Question 13 20 points Write a function named lineStats that finds the number of words and the number of characters on each line
Python 3.6
Question 13 20 points Write a function named lineStats that finds the number of words and the number of characters on each line of a file and writes those statistics to a corresponding line of a new file, separated by a space. (Hint: when you read a line from a file, the endline character is included. Do not include the endline in the number of characters on the line.) The Tunction Iznestats takes two par ameters: 1. infile, a string, the name of an input file that exists before ineStats is called 2. outfile, a string, the name of an output file that lineStats creates and writes to For example, if the following is the content of the file promisedLand. txt: The dogs on main street howl, "cause they understand, And I believe in a promised land 1 belzeve 1n a promised lana The following function call: inF ' promisedand . txt' outF ' promisedandstats. txt ' linestats(inF, outF) should create the file promisedLandStats.txt with the content: 6 29 3 23 7 32 6 31Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started