三個骰子【python---隨機數之random】

#pythonpython

import randomdom

i = int(raw_input('NUM: '))ide

e = 1spa

x = 0input

y = 0it

while e<=i:class

e=e+1import

a = int(random.randint(1,6))im

b = int(random.randint(1,6))tab

c = int(random.randint(1,6))

d = a + b + c

n = e - 1

if d <= 9:

x = x + 1

print "(%s,%s,%s)%s ------%s    LITTLE" % (a,b,c,n,d)

elif d >= 10:

y = y + 1

print "(%s,%s,%s)%s ------%s    BIG" % (a,b,c,n,d)

if x < y:

print "Big:%s  Little:%s . As result:Big!" % (y,x)

elif x > y:

print "Big:%s  Little:%s . As result:Little!" % (xy,x)

elif x == y:

print "Big:%s  Little:%s . As result:Equal!" % (y,x)

相關文章
相關標籤/搜索