Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions