0
我正在嘗試製作一個卡交易計劃。交易卡和退貨剩餘物
- 有5名球員。
- 給出了甲板訂單。
- 該方案從牌組頂部一次處理一張牌。
- 桌子的頂部是堆疊的開始。
- 程序返回:
- 5只球員手和
- 仍包中的卡。
功能:
def deal_cards(FIVE,card_list):
card_list = = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] * 4
hand_one = []
hand_two = []
hand_three = []
hand_four = []
hand_five = []
for i in card_list:
hand_one = card_list.append(i)
hand_two = card_list.pop(i + 1)
hand_three = card_list.pop(i + 2)
hand_four = card_list.pop(i + 3)
hand_five = card_list.pop(i + 4)
return hand_one, hand_two, hand_three, hand_four, hand_five
主營:
print("Deck - ", end="")
print(*card_list)
hand_one, hand_two, hand_three, hand_four, hand_five = deal_cards(card_list)
print("Player 1 - ", end="")
print(*hand_one)
print("Player 2 - ", end="")
print(*hand_two)
print("Player 3 - ", end="")
print(*hand_three)
print("Player 4 - ", end="")
print(*hand_four)
print("Player 5 - ", end="")
print(*hand_five)
好了,什麼是你的問題? –
我不知道該從這裏做什麼,不能得到代碼工作。返回剩餘值也是一樣。我主要質疑我如何將牌放在玩家手中以查看其優化與否。我得到空白打印此 – okai
歡迎來到StackOverflow。請閱讀並遵守幫助文檔中的發佈準則。 [最小,完整,可驗證的示例](http://stackoverflow.com/help/mcve)適用於此處。在您發佈代碼並準確描述問題之前,我們無法有效幫助您。 – Prune