猜拳游戏 具体代码如下: import random x = int(input("请输入:剪刀(0)、石头(1)、布(2):")) if x not in [0, 1, 2]: print("输入不合法") else : y = random.randint(0, 2) print(y) if x == y : print("平局") else: if (x == 0 and y == 2) or (x == 1 and y == 0) or (x == 2 and y == 1): print("You win") else: print("You lose")