10
John Seen 3.7
Bill Stark 2.06
Jack Connor 3.47
Drake Mason 3.05
Bill Callum 2.83
Emma Jake 3.65
William Damian 3.33
James Charlie 3.56
Oscar Rhys 3.78
George Reece 2.52
So if there are same "GPA" numbers (value) it should sort it by key (descending).
Following code sorts by value then sorts by key, but ascending
n = int(input())
grades = {}
result = ''
for i in range(n):
student = input().split()
grades[student[0] + ' ' + student[1]] = eval(student[2])
sorted_d = sorted(grades.items(), key=lambda x: (-x[1], x[0]))
for i in sorted_d:
print(str(i[0]) + " - " + str(i[1]))