You are viewing a single comment's thread. Return to all comments →
class Player: def __init__(self, name, score): self.name = name self.score = score def __repr__(self): return self.name,self.score def comparator(a, b): if a.score == b.score and a.name == b.name: return 0 if a.score > b.score: return -1 elif b.score > a.score: return 1 if a.name < b.name: return -1 return 1
Seems like cookies are disabled on this browser, please enable them to open this website
Sorting: Comparator
You are viewing a single comment's thread. Return to all comments →