Best Average Grade
Implement the function best_average_grade(exam_grades: List[Tuple[str, int]]) -> Tuple[str, float].
Given a list of students and their exam grades, return the best student and their average grade.
If multiple students have the same highest average grade, return the student whose name comes first in alphabetical order.
Examples
Input: [("Bob", 85), ("Sara", 92), ("Bob", 90), ("Sara", 95)]
Output: ("Sara", 93.5)
Input: [("Jim", 85), ("Sam", 88)]
Output: ("Sam", 88)
这道题要求你根据输入的学生姓名和考试分数,统计每个学生的平均分,并返回平均分最高的学生及其成绩。核心思路是用哈希表按姓名累加总分和次数,再遍历计算平均值;如果最高平均分并列,则按字母序选择姓名更靠前的学生。题目重点在于数据聚合、平均数计算和并列规则处理,适合用字典一次遍历完成。