Question: In this assignment, you will explore a dataset containing information about various movies, mirroring the kind of data you might find in an IMDB database.

In this assignment, you will explore a dataset containing information about various movies, mirroring the kind of data you might find in an IMDB database. The data is a list of dictionaries, each representing a movie's details. This list is available in a file named movies_data.py. Specifically, each dictionary contains the following details for each movie: title ("Title"), director ("Director"), release year ("Year"), rating ("Rating"), genre ("Genre"), and a list of main actors ("Main_Actors"). You can inspect the data by opening movies_data.py in your editor. The data should look like this:
movies_list =[
{'Title': 'Inception',
'Director': 'Christopher Nolan',
'Year: 2010,
'Rating': 8.8,
'Genre': 'Action',
'Main_Actors': ['Leonardo DiCaprio', 'Joseph Gordon-Levitt', 'Ellen
Page']},
1
To read the list of dictionaries movies_data.py you should follow these steps:
1. Make sure the movies_data.py file is in the same directory as your Python script assignment_2.py.
2. Import the list of movies by adding the following line at the top of your script: from movies_data import movies_list
Question 1(20 points)
Write a function named get_movie_rating_category. This function should accept a single movie_name (string) as an input. It searches the movies_list for a movie by the given name and returns its rating category based on the scale below:
Excellent: 8.0-10
Good: 6.0-7.9
Average: 4.0-5.9
Poor: Below 4.0
If the movie is not found, the function should return "Movie not found in the list."
Example:
print(get_movie_rating_category("Inception"))
print(get_movie_rating_category("Nonexistent Movie"))
Returns: "Excellent"
"Movie not found in the list."
Answer the questions with explanation

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 Accounting Questions!