How do you sort in non-increasing order a list of team names and scores, and secondly in lexicographical order? I have the following line of Python that I am trying to understand.
sigList.sort(key = lambda x : str(len(x)-1) + x[0], reverse= True)
From my understanding, this sorts in non-increasing order, but not in lexicographical order. I have a team name, and then the score for that team. I want it sorted by the highest score first, then by the team name. How do I do both?
Example:
BOB TEAM 9
DALE TEAM 7
KIM TEAM 3
The sort function in Python should automatically sort in lexicographical order, but I am only able to get my output sorted in non-increasing order.