''' DS2000 Spring 2020 Source code from class - building on the user interface example from Tues. V3 -- compute the average of audience ratings (floats 1-5) January 31, 2020 ''' AUDIENCE = "A" CRITIC = "C" QUIT = "Q" def choose_menu(movie): ''' Function: choose_menu Parameters: none Returns: A letter, a validated choice from the menu ''' print("Welcome to Rotten Huskies for the movie", movie, "\n" "Choose from the following options...\n" "\t", AUDIENCE, "-- Audience rating\n" "\t", CRITIC, "-- Critics consensus\n" "\t", QUIT, "-- Quit") choice = input("Enter your choice now\n") while choice != AUDIENCE and choice != CRITIC and choice != QUIT: choice = input("Invalid, try again\n") return choice def audience_rating(ratings): ''' Function: audience_rating Parameters: list of floats (audience ratings) Returns: average audience rating (float 1-5) Does: Computes the audience rating from a list of numerical ratings ''' length = len(ratings) total = 0 for i in range(length): total = total + ratings[i] return total / length def critic_rating(): ''' Function: critic_ratings Parameters: nothing yet Returns: average critics rating Does: Estimates a positive/negative score from a list of narrative critiques from a bunch of critics ''' return 0