Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

writing out code in my Python menu driven application. I have already written the def rate_movie code, but I still need help with writing the

writing out code in my Python menu driven application.  I have already written the def rate_movie code, but I still need help with writing the code below for:

  • def get_movie_recommendations
  • def view_top_rated_movies
  • def view_movie_details
  • def view_movie_poster

I have added explanations of what the code should do under each def statement. I will get the information created in the Dynamodb and S3's once the code is finished. Below you will find the structure of the python code that is being used in AWS Cloud9 environment. 

 

def rate_movie():   movie_title = input("Enter the title of the movie you want to rate: ")   try:       rating = float(input("Enter your rating for the movie (0.0 - 10.0): "))       if rating < 0 or rating > 10:           raise ValueError       # Save the movie rating to DynamoDB table       response = table.put_item(           Item={               'Title': movie_title,               'Rating': rating           }       )       print("Rating submitted successfully!")   except ValueError:       print("Invalid rating. Please enter a valid rating between 0.0 and 10.0.") def get_movie_recommendations():   pass  # Add code to retrieve and display movie recommendations based on user preferences def view_top_rated_movies():   pass  # Add code to fetch and display top-rated movies from DynamoDB table def view_movie_details():   pass  # Add code to display detailed information about a specific movie def upload_movie_poster():   pass  # Add code to upload a movie poster image to S3 bucket def main():   print("Welcome to the Movie Rating and Recommendation App!")   while True:       print("Menu:")       print("1. Rate a Movie")       print("2. Get Movie Recommendations")       print("3. View Top-Rated Movies")       print("4. View Movie Details")       print("5. Upload a Movie Poster")       print("6. Exit")        try:           choice = int(input("Enter your choice (1-6): "))       except ValueError:           print("Invalid input. Please enter a valid choice.")           continue        if choice == 1:           rate_movie()       elif choice == 2:           get_movie_recommendations()       elif choice == 3:           view_top_rated_movies()       elif choice == 4:           view_movie_details()       elif choice == 5:           upload_movie_poster()       elif choice == 6:           print("Exiting the application. Goodbye!")           break       else:           print("Invalid choice. Please enter a number between 1 and 6.") # Call the main function to start the application if __name__ == "__main__":   main()

Step by Step Solution

3.37 Rating (150 Votes )

There are 3 Steps involved in it

Step: 1

getmovierecommendations Retrieve and display movie recommendations based on user preferences def getmovierecommendations printGetting movie recommenda... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

explain the multidimensional model of sport leadership;

Answered: 1 week ago

Question

discuss the four components of effective leadership.

Answered: 1 week ago