Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 4. Write the code for this problem in a file named p3_Lastname_Firstname.py, as required above. For this problem we work with CSV files and
Problem 4. Write the code for this problem in a file named p3_Lastname_Firstname.py, as required above. For this problem we work with CSV files and dictionaries using data from IMDB lists with top rated and top grossing movies. These CSV files are linked on the Homework 2 Canvas page: - imdb-top-rated.csv, listing the ranking of the top rated 250 movies. It has this format: Rank,Title,Year,IMDB Rating - imdb-top-grossing.csv, listing the ranking of the highest grossing 250 movies. It has this format: Rank,Title,Year,USA Box Office - imdb-top-casts.csv, listing the director and cast for the movies in the above files. It has this format: Title, Year,Director,Actor 1,Actor 2,Actor 3,Actor 4,Actor 5 . The actors are listed in billing order. This file does not have a heading. These files are from Duke University and seem to date from 2014. a) Write a function called display_top_collaborations that displays the ranking of tuples (director, first billed actor (i.e. Actor1), and number of movies) for movies in which the director and actor worked together also listed in the top rated movie list. The list should be in descending ordered of the total number of movies that director and that actor worked together. For equal values the order does not matter. Notice that the number of movies in the imdb-top-casts.csv file exceeds the number of movies in imdbtop-rated.csv. You may have to open the csv files like this: open(filename, 'r', encoding = 'utf-8'). b) Write a function called display_top_directors that displays the ranking of movie directors from the top grossing list ordered by the total box office money they produced. c) Write a main() function that tests the code from parts a) and b). Take a screenshot of the program's output (parts a, b, c) where each printed ranking list is limited to the first 5 entries and insert it in the doc file right after the code. You get 8 points deducted if the screenshot is missing. Implementation requirements: Follow these requirements to get full credit. - Apply the top-down design methodology. Seek commonality among the tasks listed above. Break the problems into subproblems divide \& conquer-style, then write functions dealing with the subproblems. - Use dictionaries and the csv module to solve the problem. - Implement a simple way to optionally cut the ranking displays to a number of entries
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started