I\'m brand new to programming and Python and I\'m trying my hardest to understand and learn it. I\'m not asking for answers but explanations in plain non-computer terms so that
You don't have much, but I'll say that your lists are in pairs.
short_card = ['A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2']
long_card = ['ace', 'king', 'queen', 'jack', 'ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'deuce']
and
short_suit = ['c', 'd', 'h', 's']
long_suit = ['clubs', 'diamonds', 'hearts', 'spades']
They're each the same length and in the same order. So the index of 'A' in short_card is the same as the index of 'ace' in long_card. So if you find the index of one, you have the index of the other.
This should point you in the right direction. Come back and edit your post when you have more.
I'd do it slightly differently to the last two posters, and start with the zip
function for joining up matching lists.
So what you have is two sets of lists, which correlate the input values with the output strings. Note the order of the lists; they're the same. Which should make the index values of the inputs equal to the...
>>> def poker_card(c):
... card, suit = c
... short_cards = ['A', 'K', 'Q', 'J', 'T', '9', '8', '7', '6', '5', '4', '3', '2']
... short_suits = ['c', 'd', 'h', 's']
... long_cards = ['ace', 'king', 'queen', 'jack', 'ten', 'nine', 'eight', 'seven', 'six', 'five', 'four', 'three', 'deuce']
... long_suits = ['clubs', 'diamonds', 'hearts', 'spades']
... return "%s of %s" % (long_cards[short_cards.index(card)], long_suits[short_suits.index(suit)])
...
>>> def poker_hand(hand):
... return [poker_card(c) for c in hand]
...
>>> def main():
... print poker_hand(["Kh", "As", "5d", "2c"])
...
>>> main()
['king of hearts', 'ace of spades', 'five of diamonds', 'deuce of clubs']