Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a function read _ data that accepts a single argument corresponding to the filename, and returns a list of lists. You can find an

Define a function read_data that accepts a single argument corresponding to the
filename, and returns a list of lists.
You can find an example file to work within the Brightspace and the startercode
section of the Vocareum
Each line in the data file follows this format: [Name], num1, num2, num3....
Ben,-1,2.3,4.1,5.25,-4,0.2,0.55,1.1
Mary,2.1,1.4,-1.2,-1.5,1.0,2,3.1
Giulia,1.8,-2.2,-1.6,3
The function must return a list of lists where each sublist represents one line from the
file. All the numbers must be converted to float datatype in the returned value
Sample output:
>> print(read_data('sample_data.txt'))
[['Ben',-1.0,2.3,4.1,5.25,-4.0,0.2,0.55,1.1],['Mary',
2.1,1.4,-1.2,-1.5,1.0,2.0,3.1],['Giulia',1.8,-2.2,-
1.6,3.0]]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago