Question: Assume an input file has one or more numeric values separated by commas. We would like to create a file that contains those lines that
Assume an input file has one or more numeric values separated by commas. We would like to create a file that contains those lines that have two numeric
values and report to the screen those lines that have other than two values as well as lines with nonnumeric values.
For example, if the input file has:
the output file should have:
and the screen should display:
Line : not values:
Line : nonnumeric value: x
inputfilepath 'inputvalues.txt
with openinputfilepath, w as file:
outputfilepath 'outputvalues.txt In addition, we need to prompt the user for the name of the input file and output file, like inputfile inputPlease enter the input file name:
# Open the input file for reading
infile openinputfile, r
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
