I am trying to sort a list composed of names and grades:
[['Harry', 37.21], ['Berry', 37.21], ['Tina', 37.2], ['Akriti', 41.0], ['Harsh', 39.0]]
I want to sort them first according to the grades and then if the grades are the same, according to the alphabetical order of their names. I tried the following code but it is not working for the name sorting part. Can you tell me the problem please. Thank you
score_list=[]
for _ in range(int(input())):
name = input()
score = float(input())
score_list.append([name, score])
score_list.sort(key = lambda x: (x[1], x[0]), reverse=True)