import random class Die(): def __init__(self): self.sides=6 def roll_die(self,size): print(random.randint(1,size)) mydie=Die() for a in range(10): mydie.roll_die(6) print("6面的") for a in range(10): mydie.roll_die(10) print("10面的") for a in range(10): mydie.roll_die(20) print("20面的")