Question: PYTHON I have to modify a bit program, and I am just curious If its correct or not. Any help would be great. The program

PYTHON

I have to modify a bit program, and I am just curious If its correct or not. Any help would be great. The program works with a sql movie data base and I just have to make a few changes.

The delete movie function gets a Movie object for a specific ID and asks the user if they want to delete the movie as shown below: The code should only delete the movie after the user enters y to confirm.

Add a get_movies_by minutes() function that gets a list of Movie objects that have a running time thats less than the number of minutes passed to it as a parameter.

fix the display_movies_by_minutes() function that prompts the user to enter the maximum number of minutes and displays all selected movies. This should sort the movies by minutes in ascending order

the database categories are categoryID(int), name(txt): movieID(int),categoryID(int),name(txt),year(int),minutes(int)

## my code below for the delete movie function

def delete_movie(): movie_id = int(input("Movie ID: ")) print("Would you like to delete " + int(movie_id) + " Y or N ") if movie_id == 'N': exit() else: db.delete_movie(movie_id) print("Movie ID " + str(movie_id) + " was deleted from database. ")

## my code for display by minutes

my code below def display_movies_by_minutes(): minutes = int(input("Minutes: ")) print() minutes = db.get_movies_by_minutes(minutes) display_minutes(min(minutes))

## my code for the get movie by minutes

def get_movies_by_minutes(minutes): query = '''SELECT minutes FROM Movie '''

with closing(conn.cursor()) as c: c.execute(query, (year,)) results = c.fetchall()

minutes = [] for row in results: minutes.append) return minutes

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