#python-猜拳-三局两胜
import random
all_choice = ['石头','剪刀','布']
win_list = [['石头','剪刀',],['剪刀','布'],['布','石头']]
prompt = """(0) 石头
(1) 剪刀
(2) 布
请选择(0/1/2): """
cwin = 0
pwin = 0
while cwin < 2 and pwin < 2:
computer = random.choice(all_choice) #从all_choice中选取一个
ind = int(input(prompt)) #将prompt选出的字符转换成数字
player = all_choice[ind]
print("Your choice: %s,Computer's choice: %s" % (player,computer))
if player == computer:
print('平局')
elif [player,computer] in win_list:
pwin +=1
print('You win')
else:
cwin +=1
print('You LOSE')