# -*- coding: cp936 -*-
from random import *
#num = input("请输入骰子数:")
#dian = input("请输入骰子具有面数:")
def tou(num,dian):
count=0
for i in range(num):
count += randrange(1,dian+1)
return count
#print tou(num,dian)
#while raw_input("回车测吉凶?")=="":
#yun=["大吉","中吉","吉","一般","凶","小凶","大凶"]
#print choice(yun)
def majiang():
pai = "一 二 三 四 五 六 七 八 九".split()
xing = "万 筒 条".split()
feng = "东风 西风 南风 北风 红中 发财 白板".split()
mj = 4*["%s%s" % (n,v) for n in pai for v in xing] + 4*feng
shuffle(mj)
return mj
def puke():
pai = "红桃 梅花 方块 黑桃".split()
xing = "2 3 4 5 6 7 8 9 10 J Q K A".split()
wang = "大王 小王".split()
pk = ["%s%s" % (n,v) for n in pai for v in xing] + wang
shuffle(pk)
return pk
#pai=majiang()
pai=puke()
#print len(pai)
my=[]
for i in range(13):
my.append(pai.pop())
for i in my:
print i
关于random的一些例子
最新推荐文章于 2022-11-12 19:30:39 发布