I have a list like this:
list_results=[('Horror', 2), ('Romance', 2), ('Comedy', 2), ('History', 2), ('Adventure', 1), ('Action', 3)]
I wish to sort the number in descending order and if numbers were the same, according to the name in ascending order.
I tried the following code:
sortlist=sorted(list_results,key=lambda x:(x[1],x[0]))
and the reverse but I couldn't figure out to do it.
The answer that I'm looking for is:
[('Action', 3), ('Comedy', 2) ,('History', 2),('Horror', 2), ('Romance', 2), ('Adventure', 1), ]