2) Processing the Test Data Write a second function read_data(fname), that will read the file created in the previous problem using a for loop and print out the minimum and maximum randomly generated values in the file (the function should return nothing). Again, you should not import/use the Python csv module. In the case that the file specified by fname does not exist, you should print out "Bad file name" and end the function.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.3: Random File Access
Problem 6E
icon
Related questions
Question

Answer the given question with a proper explanation and step-by-step solution.

 

2) Processing the Test Data
Write a second function read_data(fname), that will read the file created in the previous
problem using a for loop and print out the minimum and maximum randomly generated values
in the file (the function should return nothing). Again, you should not import/use the Python csv
module.
In the case that the file specified by fname does not exist, you should print out "Bad file
name" and end the function.
Hints:
●
"-999".
Comparing strings is different from comparing integers, for example "-1" <
Convert each value to an integer before comparing it.
As with most CSV problems, you will likely want to use the .split() method to split each
line by "," to get the information out. Remember that .split() will always return a list of
strings, even if those strings are all digits.
Transcribed Image Text:2) Processing the Test Data Write a second function read_data(fname), that will read the file created in the previous problem using a for loop and print out the minimum and maximum randomly generated values in the file (the function should return nothing). Again, you should not import/use the Python csv module. In the case that the file specified by fname does not exist, you should print out "Bad file name" and end the function. Hints: ● "-999". Comparing strings is different from comparing integers, for example "-1" < Convert each value to an integer before comparing it. As with most CSV problems, you will likely want to use the .split() method to split each line by "," to get the information out. Remember that .split() will always return a list of strings, even if those strings are all digits.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr