def get_scholars(student_list):
qualified = []
for student in student_list:
avg_score = sum(student["score"]) / len(student["score"])
if avg_score >= 90 and student["volunteer"] >= 80:
qualified.append((student["name"], avg_score))
qualified.sort(key=lambda x: (-x[1], x[0]))
return [name for name, _ in qualified]
students = [
{"name": "Kim", "score": [95, 100], "volunteer": 85},
{"name": "Lee", "score": [80, 85], "volunteer": 90},
{"name": "Park", "score": [90, 92], "volunteer": 70},
{"name": "Choi", "score": [98, 97], "volunteer": 95},
{"name": "Jung", "score": [88, 92], "volunteer": 82}
]
ret = get_scholars(students)
print(ret) # ['Choi', 'Kim', 'Jung']
To embed this project on your website, copy the following code and paste it into your website's HTML: