交易卡和返还剩菜

时间:2016-11-22 23:47:50

标签: python string python-3.x

我正在尝试制作卡片交易计划。

  • 有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)

1 个答案:

答案 0 :(得分:0)

我以前用过这个:

<DataGridTemplateColumn Header="ATTENDEES" Width="*">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <ItemsControl ItemsSource="{Binding Path=attendees}" x:Name="AttendeesItemsControl"/>
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>