Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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-5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started