Question: using python, please help! Function name: average_rating Parameters: a dictionary named movies_dict (keys are the names of movies (string): values are a list of integer
using python, please help!


Function name: average_rating Parameters: a dictionary named movies_dict (keys are the names of movies (string): values are a list of integer ratings from zero to ten (list of ints)) Returns: a dictionary (keys are names of movies (string): values are that show's average rating (float)) Description: Write a function that takes in a dictionary and returns a dictionary. The function will take in a dictionary, movies_dict, where the key will be a string that represents the name of some movie and the value will be a list of integers representing ratings on a ten-point scale for that movie. The function should take this dictionary and make a new dictionary where the keys will be strings of the movie name and the values will be the average rating for that movie (rounded to 2 decimal points). Notes Remember to round the average rating of each movie to two decimal points! Every movie included in movies_dict will have at least one rating. Every rating is out of ten. If you print out your returned dictionary the order of the artists may be different from ours, what's important is that each artist (key) is correctly matched to their price totals (value) . >>> movies, dict ("Back to the Future" : [8, 7, 9, 10], Independence Day" : [8, 7, 5, 18, 10j, Men in Black" : [7, 6, 9], "Rush Hour" : [8, 9, 10, 10]} >>> test1 = average-rating(movies-dict) >>> print (test1) ('Back to the Future' ; 8.5, "Independence Day' : 8.0, Hen in Black': 7.33, Rush Hour': 9.25)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
