欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

斗地主发牌器

程序员文章站 2022-04-26 16:56:12
import random#定义54张牌huase = ['\u2665','\u2660','\u2666','\u2663']num = ['A','2','3','4','5','6','7','8','9','10','J','Q','K']kings = ['大王','小王'...
import random

#定义54张牌
huase = ['\u2665','\u2660','\u2666','\u2663']
num = ['a','2','3','4','5','6','7','8','9','10','j','q','k']
kings = ['大王','小王']

#一副牌
for i in huase:
for el in num:
kings.append(i+el)

#乱序
random.shuffle(kings)

#发牌
person1 = kings[0:17]
person2 = kings[17:34]
person3 = kings[34:51]
dipai = kings[51:]
print(person1)
print(person2)
print(person3)
print(dipai)