Firstly I created a class like this
class Student:
def __init__(self, name, grade, age):
self.name = name
self.grade = grade
Then I have a list of Student object
L = [(Student: Tim, 99), (Student: Alice, 99), (Student: Bob, 88)]
How can i sort this list in descending order of score, and then if two have the same score, sort them by name in ascending alphabetic order
I have tried to use attrgetter
, but i always get the same list like the above L
The expected output is
L = [ (Student: Alice, 99),(Student: Tim, 99), (Student: Bob, 88)]