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 moviesdata.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 MainActors" You can inspect the data by opening moviesdata.py in your editor. The data should look like this:
movieslist
Title: 'Inception',
'Director': 'Christopher Nolan',
'Year:
'Rating':
'Genre': 'Action',
'MainActors': Leonardo DiCaprio', 'Joseph GordonLevitt', 'Ellen
Page'
To read the list of dictionaries moviesdata.py you should follow these steps:
Make sure the moviesdata.py file is in the same directory as your Python script assignmentpy
Import the list of movies by adding the following line at the top of your script: from moviesdata import movieslist
Question points
Write a function named getmovieratingcategory. This function should accept a single moviename string as an input. It searches the movieslist for a movie by the given name and returns its rating category based on the scale below:
Excellent:
Good:
Average:
Poor: Below
If the movie is not found, the function should return "Movie not found in the list."
Example:
printgetmovieratingcategoryInception
printgetmovieratingcategoryNonexistent 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
