import random a=input("输入玩家请出拳:") b=["石头","剪刀","布"] if a in b: print("玩家出拳:"+a) c=random.choice(b) print("计算机出拳:"+c) if a==c: print("平局") elif (a=="石头"and c=="剪刀")or(a=="剪刀"and c=="布")or(a=="布"and c=="石头"): print("玩家赢!") else: print("计算机赢") else: print("输入错误!")