Question: PYTHON PLEASE Complete the function best_student, which computes and returns the name and age of the student who had the highest score on a recent
PYTHON PLEASE

Complete the function best_student, which computes and returns the name and age of the student who had the highest score on a recent exam. Unfortunately, the data to process is not provided to the function in a particularly convenient format. The first argument is a list containing the students' names, such as ['Qi', 'Jack', 'Connor', 'Romin']. The second argument is a list containing the students' ages and exam scores, interleaved. For instance, the list [21, 92, 25, 95, 24, 90, 26, 98] indicates that Qi is 21 years old and scored a 92, Jack is 25 years old and scored a 95, and so on. Using list methods and functions (e.g., max and index), as well as slicing, determine which student had the highest score and then return that student's name and age. Hint: remember that with slicing we can provide a third value that tells Python to select every k-th value from a list. For instance, costs[1::2] would select elements 1, 3, 5, 7, ... from the list called costs. Examples: Function Call Return Values ('Romin', 26) best_student(['Qi', 'Jack', 'Connor', 'Romin'], [21, 92, 25, 95, 24, 90, 26, 98]) best_student(['Albert', 'Cris', 'Danny'], [22, 100, 24, 90, 23, 91]) best_student(['Albert', 'Erin', 'Yang', 'Cris', 'Danny'], [25, 80, 24, 90, 27, 88, 23, 91, 24, 98]) best_student(['Toni', 'Kim'], [25, 90, 27, 88]) ('Albert', 22) ('Danny', 24) ('Toni', 25) [] def best_student (names, records): pass # delete this line and start writing your code here ! # Test cases print (best_student(['Qi', Jack', Connor' 'Romin'], [21, 92, 25, 95, 24, 90, 26, 98])) print (best_student(['Albert', 'Cris', 'Danny'], [22, 100, 24, 90, 23, 91])) print (best_student(['Albert', 'Erin', 'Yang', 'Cris', 'Danny'], [25, 80, 24, 90, 27, 88, 23, 91, 24, 98])) print (best_student(['Toni', 'Kim'], [25, 90, 27, 88]))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
