You are viewing a single comment's thread. Return to all comments →
Hi, I solved it in Python 3 without changing anything outside Player class:
def comparator(a, b): if a.score != b.score: return b.score - a.score return (a.name>b.name)-(a.name<b.name) And I agree template is incorrect. We don't need to implement repr
def comparator(a, b): if a.score != b.score: return b.score - a.score return (a.name>b.name)-(a.name<b.name)
And I agree template is incorrect. We don't need to implement repr
Sorting: Comparator
You are viewing a single comment's thread. Return to all comments →
Hi, I solved it in Python 3 without changing anything outside Player class: