#石头剪刀布
#计算机随机出拳
#玩家自己决定出拳
# 定义列表win_list,将玩家赢电脑的选择,提前保存
# 每个列表,玩家为第一个元素,电脑为第二个
import random
win_list = [["石头","剪刀"],["剪刀","布"],["布","石头"]]# pwin 玩家获胜的次数
# cwin 计算机获的次数
pwin = 0
cwin = 0
while pwin<2 and cwin<2:
computer =random.choice(["石头","剪刀","布"])
print("computer:",computer)
player = input("石头、剪刀、布:")
if player == computer:
print("平局")
elif [player,computer] in win_list:
print ("玩家赢")
pwin+=1
else:
print("电脑赢")
cwin+=1
01-12
3009
09-27