''' DS2000 Fall 2024 Sample code from lecture - class for a tv show Please do TA survey - https://bit.ly/neu-ta-students ''' RATING_THRESHOLD = 5 TONE_SCALE = 2 SEASON_SCALE = 3 class TVShow: ''' class TVShow attributes: title, rating, tone, length, num_season, year ''' def __init__(self, title, rating, tone, length, seasons, year): self.title = title self.rating = float(rating) self.tone = float(tone) self.length = length self.seasons = int(seasons) self.year = year def __str__(self): ''' return a pretty, string version of an object ''' return self.title + " with rating " + str(self.rating) def recommend(self, other): ''' return a boolean indicating if the show is good enough (rating) and similar enough (tone, seasons) to the other show ''' if self.rating > RATING_THRESHOLD: if abs(self.tone - other.tone) < TONE_SCALE: if abs(self.seasons - other.seasons) < SEASON_SCALE: return True return False