基本上是自己写出来的,留个纪念
from random import *
class Die():
def __init__(self,sides = 6):
self.sides = sides
def roll_die(self,times):
self.times = times
results = []
i = 1
while i <= self.times:
x = randint(1, self.sides)
results.append(x)
i = i + 1
print(results)
result_1 = Die()
result_1.roll_die(10)
result_2 = Die(10)
result_2.roll_die(10)