Question: use python 2.7 Your task for this part is to read the values off of a file and generate a nested list structure. Each element


use python 2.7
Your task for this part is to read the values off of a file and generate a nested list structure. Each element of the list being returned is itself a list. The second level list consists of a name and a list of ratings. parse_ratings(..) This function takes a parameter, file_name, and returns a list of the parsed lines from the file. Your function should read each line of the file, extract the data, and store the usernames and book ratings in the nested list structure you are returning. The file that you have to read the data from holds usernames and book ratings; it has the following format: David, 123 0 5 Camilla, 5 3 2 0 0 Monika, 0 0 3 Notes: 1) User names and book ratings are separated by '' 2) Book ratings are separated by a space. 3) The number of ratings can vary from user to user 4) A rating spans the values 0-5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
