随机分牌并排序
斗地主随机分牌并排序
import random
def brand():
"""
产生 54 张牌 随机分成4份[17,17,17,3]
:return: 随机分成4份的值
"""
brand_1 = ('A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', '小王', '大王')
figure = ('♦', '♠', '♣', '♥')
brand = []
for i in brand_1[:-2]:
for j in figure:
brand.append(i + j)
brand.extend(brand_1[-2:])
brand = random.sample(brand, k=54)
b
随机分牌并排序最先出现在Python成神之路。
共有 0 条评论