I have the following list
list_55 = [[1,2],[2,1],[3,4],[5,6],[4,3],[1,2],[1,2],[6,5],[6,5]]
I want to sort this list like this. So that the list sorts in an order with descending occurrence and with their reversed list. For example:
[1,2],[1,2],[1,2] followed by [2,1]
[6,5],[6,5] followed by [5,6]
[4,3] followed by [3,4] The order of this last one doesn't matter.
output:
[[1,2],[1,2],[1,2],[2,1],[6,5],[6,5],[5,6],[4,3],[3,4]]
I tried:
sorted(list_55, key=list_55.count, reverse=True)
which gives:
[[1, 2], [1, 2], [1, 2], [6, 5], [6, 5], [2, 1], [3, 4], [5, 6], [4, 3]]
and
sorted(list_55,reverse=True)
gives:
[[6, 5], [6, 5], [5, 6], [4, 3], [3, 4], [2, 1], [1, 2], [1, 2], [1, 2]]
I want a combination of these two. Is there a way to do it?