I have a list of tuples:
card_list= [(2, (1, S)), (0, (12, H)), (1, (5, C)]
This list contains cards: (cardindex, (value, suit)) where cardindex is a index to store the position of the card but irrelevant for this my particular question.
So in the example there are 3 cards in the list:
- (2, (1, S)) = Ace of Spades with an index of 2.
- (0, (12, H)) = King of Hearts with an index of 0
- (1, (5, C)) = 5 of Clubs with index 1
Well, my question is: I desire to obtain the item with the max value, this is, i have to get the item: (0, (12, H))
My attempt is:
CardWithHighestValue= max(card_list,key=itemgetter(1)[0])
But I get the item or the value? And the most important: is it really correct that sentence?
Thanks in advance.