【发布时间】:2015-08-18 19:48:19
【问题描述】:
我正在尝试用 python 制作一个基本的二十一点游戏,我想创建一个名为 Deck 的新列表。我希望Deck 在一个列表中包含所有可能的套装/等级配对(即红心 A、红心 2、红心 3 等),这样我就可以以random.shuffle 或.pop 风格开始“交易” .
如何将这两个列表配对,还是必须自己输入?
这是当前代码:
print ("Welcome to the Blackjack Table! May I have your name?")
user_name = input("Please enter your name:")
print ("Welcome to the table {}. Let's deal!".format(user_name))
import random
suits = ["Heart", "Diamond", "Spade", "Club"]
ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
values = {'A':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, '10':10, 'J':10, 'Q':10, 'K':10,}
deck =
【问题讨论】:
标签: python string list python-3.x multiplication