Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON PROGRM Websites like the Internet Movie Database (www.imdb.com) maintain extensive information about movies and actors. If you search for a movie on the website,

PYTHON PROGRM

Websites like the Internet Movie Database (www.imdb.com) maintain extensive information about movies and actors. If you search for a movie on the website, a web page showing information about the movie is displayed. It also shows all the actors in the movie. If you click on the link for an actor, you are taken to an actors page, where you can find information about him or her, including the movies the actor has appeared in. This assignment should give you some insight into the working of such websites. Here is what wed like to do with the data: Given two movie titles, create two collections A and B each representing the set of actors in each movie: (a) Find all the actors in those movies. [HINT: (A B); union operation]. (b) Find the common actors in the two movies: [HINT: (A B); intersection operation]. (c) Find the actors who are in either of the movies but not both: [HINT: (AB); symmetric difference operation]. You will use the file movies.txt, located under Resources in the Content section in D2L. The file contains 2000+ Hindi movies, the date, genre, director and partial cast list. You may need to use the movie title and year to uniquely identify a movie because some movie title are the same. This is due perhaps to movie remakes. Also, do not forget to trim spaces at the ends of each string you are reading. You do not need to use urllib for this exercise, simply dowload the data and read from a file. What is an appropriate data structure? A dictionary is suggested, as we want to access the movies and actors efficiently, but what should be the key? A key needs 2 to be unique, which rules out actors namesthey are unique in our sample but not in the whole database. On the other hand, movie titles and production dates form a unique identity that suggests an immutable tupleperfect as keys. We can arrange our dictionary with (title,year) pairs as keys and have a collection of actors in each movie as the dictionary values. As we will be looking at the intersection and union of actor combinations, that suggests using sets for the collection of actors names in each movie. Read in the data from the appropriate files and add the data to a dictionary that is structured as described. For each problem create a PYTHON function that will take two movie titles as input and will perform the desired operation.

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

Step: 3

blur-text-image

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 Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago