猜拳游戏
## 猜拳游戏
#coding=utf-8
import random
#循环输入
while True:
#玩家输入
playerstr = input("请输入 剪刀(0) 石头(1) 布(2),输入'q'则退出:")
if playerstr == 'q':
break
player = int(playerstr)
#电脑随机
computer = random.randint(0,2)
#判断输赢(玩家)
#赢
if (player==0 and computer==2) or (player==1 and computer==0) or (player==2 and computer==1):
print("恭喜你!你赢了。")
#平局
elif player==computer:
print("平局")
#输
else:
print("你输了!再接再厉。")