| top_words: List[str] = []
|
| # we go through the highest scoring words first
|
| for _, words in words_sorted_by_score.items():
|
| # then per score through the alphabetically sorted list of words with this score
|
| for word in sorted(words):
|
| # as long as we don’t have enough words we keep appending a word to the result
|
| if len(top_words) < self.MAX_LEADERBOARD_LENGTH:
|
| top_words.append(word)
|
| else:
|
| break
|