I have a list of strings:
cards = ['2S', '8D', '8C', '4C', 'TS', '9S', '9D', '9C', 'AC', '3D']
and the order in which I want to display the cards:
CARD_ORDER = ['2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A']
This is how I'm trying to order the list:
sorted(cards, lambda x,y: CARD_ORDER.index(x[0]) >= CARD_ORDER.index(y[0]) )
Unfortunately this does not seem to work....
or more precisely the list stays exactly the same, sorted(cards) works fine instead.
Any ideas?