Let's say I have two lists
future_ranking = [3, 6, 9, 6]
games_played = [1, 3, 3, 2]
Now my goal is to convert this into a ranking of indexes
[2, 3, 1, 0]
This would be the expected output.
Problem is, I did my cool lambda function okay?
my_cool_lambda = sorted(range(len(future_ranking)), key = lambda x: future_ranking[x], reverse = True)
And at first I was like, damn, everything is going super fine! I'm totally gonna be a programmer one day. Until I realized that my cool lambda function, when two scores are the same, it gives the higher spot to whatever index comes first, and that's not what I want. The higher spot in case of a tie in points should be given to the index that played less games.
So the output I get is
[2, 1, 3, 0]
And the output i want is
[2, 3, 1, 0]
Does anyone knows how can I fix this? I know it's not like cool to ask "hey can you basically do this for me?" but I have no clue rn and I swear I tried a lot.