Python学习——猜拳小游戏
import random
player = int(input(“请输入:剪刀 0,石头 1,布2”))
computer = random.randint(0,2)# print(“玩家输入的是%d,电脑输入的是%d” %(player,computer)) 用于测试
if (player == 0) and (computer == 0) or (player == 1) and (computer == 1) or (player == 2) and (computer == 2):
print(“平局,继续决战到天亮”)
elif (player == 0) and (computer == 1) or (player == 1) and (computer == 2) or (player == 2) and (computer == 1):
print (“输了,要加油”)
else:
print (“赢了,太厉害”)