# -*- coding: UTF-8 -*-
import random,time
def randstr(x):
num=int(random.uniform(1,7))
return [num,"第" + str(x) + "个骰子摇出来的点数是:" + str(num) + "\n"]
def tous(r):
sum,constr=0,""
# range(r) means 0 to r so use below
for i in range(1,r+1):
conresult=randstr(i)
sum+=conresult[0]
constr+=conresult[1]
return [sum,constr]
def calltous(k,v):
daxiao=("点数为小","点数为大")
result=tous(k)
print result[1] + "所有骰子摇得的总数是:" + str(result[0]) + "\n" + daxiao[(result[0]-v)>0] + "\n"
while True:
calltous(3,10)
time.sleep(1.3)