#石头剪刀布
#计算机随机出拳
#玩家自己决定出拳
# 定义列表win_list,将玩家赢电脑的选择,提前保存
# 每个列表,玩家为第一个元素,电脑为第二个
import random
win_list = [["石头","剪刀"],["剪刀","布"],["布","石头"]]
computer =random.choice(["石头","剪刀","布"])
print("computer:",computer)
player = input("石头、剪刀、布:")
if player == computer:
print("平局")
elif [player,computer] in win_list:
print ("玩家赢")
else:
print("电脑赢")
02-16
4396
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)