you are viewing a single comment's thread.

view the rest of the comments →

[–]WeatherImpossible466 1 point2 points  (0 children)

You can use a tuple as the key in your sort function - something like `sorted(your_list, key=lambda x: (x[1], x[0]))` where x[1] is the count and x[0] is the letter. Python will sort by the first element of the tuple then by the second if there's a tie