How to reorganize a list of tuples?
问题 Say I had a list of tuples: [(98, 'studentA'), (97, 'studentB'), (98, 'studentC'), (95,'studentD')] And I wanted to organize it so that the students are grouped together by the first number in the tuple, what would be the best approach? I was thinking about creating an array of lists, in which each index of the array would be a different score (98, 97, and 95 in this example) and the students would be in the list at that index. For a much larger dataset I was considering creating a chaining