12.13

实现发牌器(牌中不包含大

import random
l=["黑桃","红桃","梅花","方片"]
l3=["A",1,2,3,4,5,6,7,8,9,10,"J","Q","K","A"]
l2=[]
for i in l:
    for j in l3:
        l2.append(i+str(j))
print(l2)
random.shuffle(l2)
print (l2)
people1=[]
people2=[]
people3=[]
people4=[]
sum=0
for i in range(len(l2)):
    sum+=1
    if sum <=13:
        people1.append(l2[i])
    elif 13< sum <= 26:
        people2.append(l2[i])
    elif 26 < sum <= 39:
        people3.append(l2[i])
    elif 39 < sum<=52:
        people4.append(l2[i])

print('people1{}'.format(people1))
print('people2{}'.format(people2))
print('people3{}'.format(people3))
print('people4{}'.format(people4))

 

小鬼),共4个玩家,没人13张牌

posted on 2018-12-13 20:33  fpybky  阅读(64)  评论(0编辑  收藏  举报

导航