Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON 3 Netflix stores a database that we can represent as a dict, whose keys are movie titles like 'Pscyho' (str); associated with each title

PYTHON 3

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 score_dict function to return a dict whose keys are the scores, where each reviewer is associated with a set of 2-tuples (movie names and their reviewer). If db is bound to the database above, calling score_dict (db) returns the dict

{1: {('Psycho', 'Diane'), ('Psycho', 'Alan')}, 2: {('Jaws', 'Carrie'), ('Up', 'Alan')}, 3: {('Amadeus', 'Diane'), ('Amadeus', 'Bob'), ('Amadeus', 'Carrie')}, 5: {('Jaws', 'Alan'), ('Up', 'Diane'), ('Psycho', 'Carrie'), ('Psycho', 'Bob')} }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions