其他分享
首页 > 其他分享> > 丢个骰子

丢个骰子

作者:互联网

###Concepts:
* Build-in module.
* Practice on module, class, object, tuple.
###Codes:
import random
class Dice:
def roll(self):
first = random.randint(1, 6)
second = random.randint(1, 6)
third = random.randint(1, 6)
forth = random.randint(1, 6)
fifth = random.randint(1, 6)
return first, second, third, forth, fifth
dice = Dice()
print(dice.roll())

标签:骰子,Dice,randint,random,module,second,丢个,forth
来源: https://www.cnblogs.com/Dennis-HM/p/11264798.html