Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a function named read_student_data(filename) which takes a filename as a parameter. The function reads and returns a dictionary of student data. The name of

Define a function named read_student_data(filename) which takes a filename as a parameter. The function reads and returns a dictionary of student data. The name of the text file to be processed is specified in the filename parameter. The text file contains 1 or more lines of student data. Each line consists of a student name followed by their marks. Each data item in a line is separated by a comma (",") The function reads each line of student data in the file and returns a dictionary. Each key in the dictionary is a student name and the value is a list of marks for the student. Remember to close the input file.

Click here to download a sample input text file.

For example:

Test Result
a_dict = read_student_data("data_file_1.txt") for key in sorted(a_dict.keys()): print(key, a_dict[key])
Adriana Ferraro [53, 37, 43, 21, 61, 14, 56, 48, 30, 96] Damir Azhar [26, 14, 35, 97, 48, 37, 94, 58, 77, 71] Jane Chang [42, 4, 7, 90, 72, 4, 31, 47, 69, 72] Kathy Azhar [93, 87, 83, 60, 29, 48, 45, 96, 66, 71] Peter Jones [77, 72, 83, 41, 86, 52, 73, 12, 26, 97] 
a_dict = read_student_data("data_file_0.txt") for key in sorted(a_dict.keys()): print(key, a_dict[key])
Damir Azhar [26, 14, 35, 97, 48, 37, 94, 58, 77, 71]

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

Step: 3

blur-text-image

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

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago