如何将我删除的卡片添加到我的手单中?抽牌移除了卡片,但我不知道如何将这些移除的卡片添加到手牌列表中。
import random
deck = ["sA", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "sJ", "sQ",
"sK", "dA", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", "dJ",
"dQ", "dK", "cA", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10",
"cJ", "cQ", "cK", "hA", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9",
"h10", "hJ", "hQ", "hK"]
def draw():
if len(deck) == 52:
random_item_from_deck = random.choice(deck)
deck.remove(random_item_from_deck)
random_item_from_deck = random.choice(deck)
deck.remove(random_item_from_deck)
random_item_from_deck = random.choice(deck)
deck.remove(random_item_from_deck)
random_item_from_deck = random.choice(deck)
deck.remove(random_item_from_deck)
random_item_from_deck = random.choice(deck)
deck.remove(random_item_from_deck)
hand=[]
hand.append()
print ("cards in deck : " + str(deck))
draw()
print ("Deck after removal of cards : " + str(deck))
print ("Cards in hand : " + str(hand))