当前位置:首页 > Python教程 > python技巧

三个骰子【python---随机数之random】

#python

import random

i = int(raw_input(‘NUM: ‘))

x=1

while x<=i:

x=x+1

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

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

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

d = a + b + c

if d <=9:

print "%s ------%s    LITTLE" % (x,d)

elif d >= 10:

print "%s ------%s    BIG" % (x,d)


本文出自 “L.P.F” 博客,请务必保留此出处http://liupengfang1015.blog.51cto.com/6627801/1841087

原文:http://liupengfang1015.blog.51cto.com/6627801/1841087


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!