Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define the function getValidMoviesData that: accepts a list of movie titles Uses the getMoviesData function to return a list of valid movie dictionaries. This

  

Define the function getValidMoviesData that: accepts a list of movie titles Uses the getMoviesData function to return a list of valid movie dictionaries. This function needs to test the return value from getMovies Data to filter out any False return values. def getValidMovies Data (movieTitles): return None # Run this cell to test the function for movie in getValid MoviesData(["Superbabies: Baby Geniuses 2", "The Shawshank Redemption", "Foobarbat", "asdfasdfasdfasdfasdf" "Thor"]): print (movie [ 'Title'], movie [ 'Year']) 3 def getOMDBData(title, apikey): url = 'https://www.omdbapi.com/' params = {'t': title, 'apikey': apikey} try: response = requests.get(url, params-params) data response.json () if data[ 'Response'] == 'False': return false return data except: return False def getMoviesData (movieTitles): apikey= 'apikey' movies = [] for title in movieTitles: movie_data = getOMDBData (title, apikey) if movie_data: movies.append(movie_data) return movies

Step by Step Solution

There are 3 Steps involved in it

Step: 1

You can define the getValidMoviesData function as follows import requests def getOMDBDatatitle apike... 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

Database Systems Design Implementation and Management

Authors: Carlos Coronel, Steven Morris

13th edition

1337627909, 978-1337627900

More Books

Students also viewed these Programming questions

Question

1 + 1 1- sinx 1 + sinx

Answered: 1 week ago