Question: PYTHON 3 | BODY MUST BE EXACTLY ONE STATEMENT: just a RETURN statement. use comprehension where necessary Netflix stores a database that we can represent

PYTHON 3 | BODY MUST BE EXACTLY ONE STATEMENT: just a RETURN statement. use comprehension where necessary

Netflix stores a database that we can represent as a dict, whose keys are movie titles like 'Pscyho' (str); associated with each title is a set of 2-tuples. Each 2-tuple specifies the name of a reviewer (str) followed by a review score (int: a number 0-5); for example ('Alice', 5). A simple/small database can look like

 {'Psycho': {('Bob', 5), ('Carrie', 5), ('Alan', 1), ('Diane', 1)}, 'Amadeus': {('Carrie', 3), ('Diane', 3), ('Bob', 3)}, 'Up': {('Alan', 2), ('Diane', 5)}, 'Jaws': {('Carrie', 2), ('Alan', 5)} } Define the lowest_order function to return a list of 2-tuples (movie name, reviewer score) sorted by the lowest score from any of its reviewers, from highest to lowest, with equal lowest score movies listed alphabetically. If db is bound to the database above, calling lowest_order (db) returns the list [('Amadeus',3), ('Jaws',2), ('Up',2), ('Psycho',1)] 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!