Question: help with python. Problem Overview The company you work for is exploring the creation of a movie streaming service, Movie Me! Viewers will be asked

help with python.

Problem Overview

The company you work for is exploring the creation of a movie streaming service, Movie Me! Viewers will be asked to pick some of their favorite movies of all time so that the service can suggest other movies. They are asking you to implement their initial heuristics, matching a favorite movie with another movie to determine the probability the viewer will enjoy another movie.

Functions

Write these functions, implementing the scenarios described. Functions other than main should contain no user input and no display of information to the user. Please use the function names shown; my test code depends on exact naming.

help with python. Problem Overview The company you work for is exploring

global variables

Create global variables for the weightings used to determine whether the viewer will like a movie: director (.15), lead actor(.20), decade (.1), and categories (.5).

main

In main, create two movies: a favorite movie and another movie to match against the favorite. Each one should contain this data, represented in a tuple: Title, director, lead actor, year(an integer), the boolean literals representing whether the movie falls into each of these categories: Anime, Family, Comedy, Drama, Horror, Romance, Sci-Fi, and Thriller.It should display the two movies. It is okay to display them in tuple form.It should then pass these two movies to calcLikeProbability, which will return a probability. That result should be shown in a message like this(note the single digit after the decimal point): The probability the viewer will like the other movie is 58.3%

calcLikeProbability

This function is the heart of the algorithm, determining whether the viewer is likely to enjoy the second movie given their love for the first. Movie Me! has determined that director is an important factor. If the second movie has the same director as the first movie, then the director probability mentioned aboveis added to the overall probability. Lead actor is also important; use the same logic here. Call calcDecadeProbabilityand multiply its result by the decade probability. Then, add that to the overall probability.Lastly, deal with categories. The goal here is to find the matches between the categories in which the favorite movie falls(e.g., Comedy, Horror) and the second movie falls (e.g., Horror, Sci-Fi).If there is an exact matchin categories, you should return 1.0 to represent that. Otherwise, determine the percentage based on how many categories are in the favorite movie, e.g., in the examples in this paragraph, the favorite movie fell into two categories,but only one was matched, so the probability is 1/2or 0.5. If there is no match, then you should return 0.0here.

calcDecadeProbability

Movie Me! has also found that viewers tend to like movies from certain decades more than others. Compare the two decades to decide whether to return 1.0 (same decade), 0.5 (adjacent decade), or 0.0 (non-adjacent decade).

Hints

Functions should have only one return statement, the last statement in the function

While turning the problem description into code, remember that your first attempt will probably not achieve the simple elegance the problem deserves. Think carefully about finding simpler/shorter code paths without sacrificing readability or making it hard to map the problem to the code. Also remember that just because something is mentioned first in the problem description, that doesnt mean its the first thing in your code; you can often simplify by reorganizing.

Functions dealing with Boolean expressions and/or returns should achieve Boolean Zen; they are often simpler and shorter than you first imagine.Code duplication is undesirable; watch for situations where it can be eliminated or minimized.

none Function Purpose/Tasks Parameters Returns main Create tuples for two movies, none call calcLikeProbability to determine probability, output results calcLikeProbability Determines the probability the Favorite movie Probability of liking, in viewer will like the second (a tuple), range 0.0 (no chance) to movie, given that the first is a another movie 1.0 (certain) favorite (a tuple) calcDecade Probability Given two years, determine Year of favorite Probability of liking, the probability the user will movie, year of either 1.0 (movies in like other movies from the another movie same decade),.5 year the second movie was (movies within adjacent released decades), or 0 (movies farther apart) none Function Purpose/Tasks Parameters Returns main Create tuples for two movies, none call calcLikeProbability to determine probability, output results calcLikeProbability Determines the probability the Favorite movie Probability of liking, in viewer will like the second (a tuple), range 0.0 (no chance) to movie, given that the first is a another movie 1.0 (certain) favorite (a tuple) calcDecade Probability Given two years, determine Year of favorite Probability of liking, the probability the user will movie, year of either 1.0 (movies in like other movies from the another movie same decade),.5 year the second movie was (movies within adjacent released decades), or 0 (movies farther apart)

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!