赞
踩
- from random import randint
- class Die():
- def __init__(self,sides = 6):
- self.sides = sides
- def roll_die(self):
- x = randint(1,self.sides)
- print(x)
- zhishaizi_1 = Die(6)
- for side in range(6):
- zhishaizi_1.roll_die()
- print("\n")
- zhishaizi_2 = Die(10)
- for side in range(10):
- zhishaizi_2.roll_die()
- print("\n")
- zhishaizi_3 = Die(20)
- for side in range(20):
- zhishaizi_3.roll_die()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。