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