I have a list of tuples in my Blender python code

scores=[(1489,"Sean"), (2850,"Bob"), (276,"Crap Player"), (78495, "Great Player"), (8473, "Damian"), (4860, "Andy"), (0, "Stephen")]

I'm trying to sort them by their score by using this

sorted(scores, key=lambda score: score[0], reverse=True)

but this is not working. I have no idea why. Any tips?

I've considered maybe a better implementation is to create a new Score class with fields name and score

EDIT:

Thanks guys for the fast reply

it was giving me no errors with the sorted method but was not sorting. I used the sort() and it works.

I think python is just a little weird in Blender maybe?

Thanks!

Edit
Report