我试图将列表cards
中的单词分配给变量。这是我试图使用的代码,但它返回False
playerdeck = ['Five of Spades', 'Eight of Spades',
'Eight of Clubs', 'Four of Clubs', 'Ace of Spades',
'Eight of Hearts', 'Four of Diamonds']
cards = ['King', 'Queen', 'Jack', 'Ace',
'Two', 'Three', 'Four', 'Five',
'Six', 'Seven', 'Eight', 'Nine',
'Ten']
new = cards in playerdeck
print(new)
有人能帮忙吗
您可以尝试:
试试这个,它首先遍历卡片并检查哪些卡片在玩家牌堆中。如果存在匹配项,它会将其附加到新卡并转到下一张卡
相关问题 更多 >
编程相关推荐