关于这种扑克牌游戏的实现的问题

时间:2018-05-25 21:11:11

标签: python playing-cards

from enum import Enum
from enum import IntEnum

class Suits(Enum):
    DIAMONDS="diamonds"
    HEARTS="hearts"
    SPADES="spades"
    CLUBS="clubs"


class Values(IntEnum):
    TWO=2
    THREE=3
    FOUR=4
    FIVE=5
    SIX=6
    SEVEN=7
    EIGHT=8
    NINE=9
    TEN=10
    JACK=11
    QUEEN=12
    KING=13
    ACE=14


deck_of_cards=[]


class Playing_Cards():
    def __init__(self, card_value, card_suit):
        self.card_value=card_value
        self.card_suit=card_suit

deck_of_cards=[]

for suit in Suits:
    for value in Values:
        deck_of_cards.append(Playing_Cards(value,suit))

print(deck_of_cards)

我想打印deck_of_cards并显示对象列表。你能解释一下原因吗?

[<__main__.Playing_Cards object at 0x102268128>,
<__main__.Playing_Cards object at 0x102268198>,
<__main__.Playing_Cards object at 0x1022681d0>, <__main__.Playing_"

问题:

  1. 我是否正确地将cards(value, suit)添加到列表中?
  2. 我如何print列表中的内容deck_of_cards

0 个答案:

没有答案