# 猜拳游戏
"""
石头1 布2 剪刀3
赢:
电脑 我们 结果
1 2 -1
2 3 -1
3 1 2
输:
电脑 我们 结果
1 3 -2
2 1 1
3 2 1
平局:
电脑 我们 结果
1 1 0
2 2 0
3 3 0
"""
#
# 1。电脑出拳出1,2,3
import random
for i in range(3):
computer=random.randint(1,3)
# 2。我们出拳 input
we=input("我们出什么?")
we=int(we)
# 3。看输赢
wd = computer-we
if 1<= we<=3:
if wd ==-1 or wd ==2:
print("we win")
elif wd ==-2 or wd ==1:
print("we lose")
elif wd ==0:
print("平")
else:
print("请不要瞎出")
print("电脑:"+str(computer))
print("我们:"+str(we))
jiayu - 猜拳游戏
猜你喜欢
转载自blog.csdn.net/houlaos/article/details/104196283
今日推荐
周排行