Knowee
Questions
Features
Study Tools

Cartoon movies are rated based on their contents on a scale of 1 to 5. (1-very low, 5 – very high).Your task is to read a 2D array, to store the rating of the N movie for D days as an N×D matrix. Print the movie position in the matrix that received the highest rating for each day.Print the result only if the number of movies is greater than 1.If more than one movie has highest rating for a particular day, print the movie that was rated first.Sample Input3 (N -number of movies)2 (D-number of days)4 41 54 3Sample OutputDay 1 movie 1 rating 4Day 2 movie 2 rating 5Sample Input1 (N -number of movies)4 (D-number of days)Sample OutputMovie rating cannot be done for one movie

Question

Cartoon movies are rated based on their contents on a scale of 1 to 5. (1-very low, 5 – very high).Your task is to read a 2D array, to store the rating of the N movie for D days as an N×D matrix. Print the movie position in the matrix that received the highest rating for each day.Print the result only if the number of movies is greater than 1.If more than one movie has highest rating for a particular day, print the movie that was rated first.Sample Input3 (N -number of movies)2 (D-number of days)4 41 54 3Sample OutputDay 1 movie 1 rating 4Day 2 movie 2 rating 5Sample Input1 (N -number of movies)4 (D-number of days)Sample OutputMovie rating cannot be done for one movie

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This problem can be solved using Python programming language. Here is a step-by-step solution:

Step 1: First, we need to take the input for the number of movies (N) and the number of days (D). We can use the input() function in Python for this.

N = int(input())  # Number of movies
D = int(input())  # Number of days

Step 2: We need to check if the number of movies is greater than 1. If not, we print "Movie rating cannot be done for one movie" and end the program.

if N <= 1:
    print("Movie rating cannot be done for one movie")
    exit()

Step 3: If the number of movies is greater than 1, we need to take the ratings for each movie for each day. We can use a 2D list (list of lists) in Python to store these ratings.

ratings = []
for i in range(N):
    ratings.append(list(map(int, input().split())))

Step 4: Now, we need to find the movie with the highest rating for each day. We can do this by iterating over the 2D list and keeping track of the maximum rating and its position.

for i in range(D):
    max_rating = -1
    max_movie = -1
    for j in range(N):
        if ratings[j][i] > max_rating:
            max_rating = ratings[j][i]
            max_movie = j
    print(f"Day {i+1} movie {max_movie+1} rating {max_rating}")

This will print the movie position in the matrix that received the highest rating for each day. If more than one movie has the highest rating for a particular day, it will print the movie that was rated first.

This problem has been solved

Similar Questions

Directions: The given graph shows how a particular movie was rated by users of an online movie review site. Each user could vote only once. Go through the given graph and answer the questions based on it.

Not Boring MoviesX city opened a new cinema, many people would like to go to this cinema. Thecinema also gives out a poster indicating the movies’ ratings and descriptions.Please write a SQL query to output movies with an odd numbered ID and adescription that is not 'boring'. Order the result by rating.For example, table cinema:idmoviedescriptionrating1Wargreat 3D8.92Sciencefiction8.53Irishboring6.24Ice SongFantasy8.65House cardInteresting9.1For the example above, the output should be:idmoviedescriptionrating5House cardInteresting9.11Wargreat 3D8.9Optionsselect movie, description, ratingfrom cinemawhere id % 2 != 1 and description <> 'boring'order by rating asc;select id, movie, descriptionfrom moviewhere rating % 2 = 1 and description <> 'boring'order by rating;select id, movie, description, ratingfrom cinemawhere id % 2 = 1 and description <> 'boring'order by rating desc;select id, movie, description, ratingfrom ratingwhere id % 2 = 1 and description <> 'boring'order by cinema desc;

Randy is attending film school and one of his projects involves researching the ratingsgiven to movies by critics and viewers. He has selected a random sample of movies andhas recorded the average critic score (X1) and the average viewer score (X2) for eachmovie. The scores were obtained from a website that collates movie reviews and ratingssubmitted by critics and viewers. Randy also recorded the genre (X3) of each movie. Thedata are stored in the file AssignmentData.RData in the data frame movies.df.(a) [3 marks] Create a scatter plot of average critic score against average viewer scorefor comedies, with average viewer score along the x-axis. Make sure to give yourplot a proper descriptive title and appropriate labels for the x and y axes. Describethe relationship between these two variables for comedies

Randy is attending film school and one of his projects involves researching the ratingsgiven to movies by critics and viewers. He has selected a random sample of movies andhas recorded the average critic score (X1) and the average viewer score (X2) for eachmovie. The scores were obtained from a website that collates movie reviews and ratingssubmitted by critics and viewers. Randy also recorded the genre (X3) of each movie. Thedata are stored in the file AssignmentData.RData in the data frame movies.df.(a) [3 marks] Create a scatter plot of average critic score against average viewer scorefor comedies, with average viewer score along the x-axis. Make sure to give yourplot a proper descriptive title and appropriate labels for the x and y axes. Describethe relationship between these two variables for comedies.(b) [2 marks] Determine whether the average critic scores and the average viewerscores are more highly correlated for comedies or for thrillers. Provide a clearjustification for your answer.(c) [3 marks] For thrillers, test whether the population proportion of movies that havean average viewer score greater than 3.27 is less than 0.5. Clearly state your hypothe-ses, making sure to define any parameters, and use a significance level of α = 3%.Do not use any R functions that are designed to perform hypothesis tests.(d) [4 marks] For dramas, test whether the population mean average viewer score isgreater than the population mean average critic score by more than 0.05. Clearlystate your hypotheses, making sure to define any parameters, and use a significancelevel of α = 3%. Do not use any R functions that are designed to perform hypothesistests

Randy is attending film school and one of his projects involves researching the ratingsgiven to movies by critics and viewers. He has selected a random sample of movies andhas recorded the average critic score (X1) and the average viewer score (X2) for eachmovie. The scores were obtained from a website that collates movie reviews and ratingssubmitted by critics and viewers. Randy also recorded the genre (X3) of each movie. Thedata are stored in the file AssignmentData.RData in the data frame movies.df.(a) [3 marks] Create a scatter plot of average critic score against average viewer scorefor comedies, with average viewer score along the x-axis. Make sure to give yourplot a proper descriptive title and appropriate labels for the x and y axes. Describethe relationship between these two variables for comedies.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.