猜拳游戏
# -*- codeing = utf-8 -*-
# @Time : 2021/6/17 19:21
# @Author : yz
# @File : 石头剪刀布.py
# @Software : PyCharm
import random
while 1:
id_1 = random.randint(0, 2)
ren = int(input("请输入:剪刀(0)、石头(1)、布(2):"))
if ren in (0,1,2):
if id_1 == ren:
print("和局请继续!")
continue
elif id_1 == 0 and ren == 1:
print("恭喜你赢了!")
break
elif id_1 == 0 and ren == 2:
print("很抱歉,你输了,请继续,再接再厉!")
continue
elif id_1 == 1 and ren == 0:
print("恭喜你赢了!")
break
elif id_1 == 1 and ren == 2:
print("很抱歉,你输了,请继续,再接再厉!")
continue
elif id_1 == 2 and ren == 0:
print("很抱歉,你输了,请继续,再接再厉!")
continue
elif id_1 == 2 and ren == 1:
print("恭喜你赢了!")
break
else:
print("输入有误,输入0,1,2数字即可参加猜拳游戏")
continue