Question: python language Function Name: class_finder Parameters: courseDict ( dict), friendsList ( list ) Returns: goodClasses ( list ) Description: Write a function that takes in
python language


Function Name: class_finder Parameters: courseDict ( dict), friendsList ( list ) Returns: goodClasses ( list ) Description: Write a function that takes in a list of your friends and a dictionary that maps the names of different courses as strings to lists of the course rosters. The function should return a list of the courses that have at least two of your friends in them. The format of courseDict will be as follows: course1: [personi, person2, ...), course2: [personi, person2, ...), Hint: The python in operator might be useful! >>> courseDict = {"CS1301": ["Damian", "Peter", "Jasmine C.", "Jakob", "Cathy" ] , "CS2110" : ["Arushi", "Brae", "Arvin", "Cathy", "Jasmine Y.", "Caitlin"), "CS 1332": ["Damien", "Jakob", "Juliette", "Jasmine Y." "Jasmine C.", "Arvin"]} >>> friendsList = ["Damian", "Peter", "Brae", "Arushi"] >>> print(class_finder(courseDict, friendsList)) ['CS1301', 'CS2110'] >>> courseDict = {"MATH2550": ["Jakob", "Peter", "Arushi", "Anthony", "Arvin"), "PSYC1101": ["Anthony", "Peter", "Arvin", "Juliette", "Brae", "Jasmine Y."], " EAS1600": ["Anthony", "Jasmine C.", "Jakob", "Damien", "Caitlin"), "APPH1040": ["Rajit", "Peter", "Jasmine Y.", "Cathy", "Damien", "Arushi"]} >>> friendsList = ["Jakob", "Jasmine Y.", "Anthony" ] >>> print(class_finder(courseDict, friendsList)) [ 'MATH2550', 'PSYC1101', 'EAS1600']
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
