import random class students: def __init__(self): self.computerfist=random.randint(1,3) def play(self): if my_fist>self.computerfist: print("我赢了") elif my_fist==self.computerfist: print("平局") elif my_fist<self.computerfist: print("我输了") n=0 while n<=3: my_fist=int(input("请输入1~3之间的数")) a=students() a.play() n+=1