我已经设置了所有 52 张卡片,我尝试使用for loop
. 我现在不知道如何设置我for loop
的。
def define_cards(n):
rank_string = ("ace","two","three","four","five","six","seven","eight","nine","ten","jack","queen","king")
suit_string = ("clubs","diamonds","hearts","spades")
cards = []
for suit in range(4):
for rank in range(13):
card_string = rank_string[rank] + " of " + suit_string[suit]
cards.append(card_string)
print "The cards are:"
for i in range(52): #how to make this for loop work??
print i, card_string[i]
我想这样打印
The crads are:
0 ace of clubs
1 two of clubs
2 three of clubs
...
49 jack of spades
50 queen of spades
51 king of spades