Write a function that takes a file name as argument. Use this function to open the file data.csv, using open, read the data in using read and break the data down into three columns, x, y and z using split. There is no metadata in the file which simplifies the task.

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

Python.

data.csv contains:

1.2,2.1,1.1
2.3,3.2,0.6
0.7,1.9,0.1
1.8,2.5,0.3
4.6,2.7,0.9

Write a function that takes a file name as argument. Use this function to open the file
data.csv, using open, read the data in using read and break the data down into three
columns, x, y and z using split. There is no metadata in the file which simplifies the task.
Print the data out in the following format:
y
1.200 2.100 1.100
2.300 3.200 0.600
0.700 1.900 0.100
1.800 2.500 0.300
4.600 2.700 0.900
Transcribed Image Text:Write a function that takes a file name as argument. Use this function to open the file data.csv, using open, read the data in using read and break the data down into three columns, x, y and z using split. There is no metadata in the file which simplifies the task. Print the data out in the following format: y 1.200 2.100 1.100 2.300 3.200 0.600 0.700 1.900 0.100 1.800 2.500 0.300 4.600 2.700 0.900
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Files and Directory
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