我想要一个类似于[“国王S”,“国王H”,“王牌S”,“4 C”] 然后,当要求用户输入要放在哪张卡上时,如果用户写了king,两个king都将从列表中删除
我刚刚开始编码,到目前为止,我已经作出的代码,以便如果你键入一个特定的卡,如“国王H”,它将被带出名单
dropCard = input()
dropCardCapital = dropCard.title()
while dropCardCapital not in pOneCards:
print("You do not have the card " + dropCardCapital + ", please type a card that you have.")
dropCard = input()
dropCardCapital = dropCard.title()
if dropCardCapital in pOneCards:
print("You dropped " + dropCardCapital)
DCCC = Counter([dropCardCapital])
pOneCards = set(pOneCardsCounter - DCCC)
pOneCardsCounter = Counter(pOneCards)
pOneCards是我希望从中取出卡片的列表。它检查输入是否在pOneCards中,如果使用计数器,它会从pOneCards列表中减去您的输入。但是我想发生的是,如果你的输入是king,并且列表中有两个king,那么两个king都会被减去
我也同意,不是让每张卡都有四个“大号”而不是指定颜色或适合它
我创建了函数
remove_card()
,在该函数中,您可以仅通过值或使用值和颜色指定卡片:印刷品:
相关问题 更多 >
编程相关推荐