Implement a function called toprated the function will take


PYTHON:

1.Implement a function called topRated(). The function will take a file name as a parameter and return a sorted list. The file it reads in contains 500 numeric movie IDs and their rating by user. The function should return a list of movie IDs and their average rating based on the file data. The list that is returned should also be sorted by average rating. I have included code in the extra credit template to do that for you.

HINT: The best way to tackle this problem is to break it up into two parts. You must first read the file in and create a dictionary of all the movie IDs as keys. The value to those keys should be a list. Worry about solving the average after the dictionary is created

2. What good are movie IDs and ratings? You want to know the actual title of the movie! Implement a function called getTitles(). The function takes two parameters.

The first is the list we created in the previous problem. The second is a text file containing movie IDs and titles. The function should loop through the list of IDs that is passed to it and through the text file.

When an ID in the list matches that of an ID in the text file you know the title in the text file is associated with that ID. Return a sorted list by average rating.

Solution Preview :

Prepared by a verified Expert
Python Programming: Implement a function called toprated the function will take
Reference No:- TGS01528533

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)