import random
win_num = 0
lose_num = 0
num = 1
while num<=3:
    user = int(input('请输入(0 石头 ; 1 剪刀 ; 2布):'))
    if user > 2:
        print('请输入正确数字')
    else:
        data = ['石头','剪刀','布']
        com = random.randint(0,2)
        print(f'您出的是{data[user]},电脑出的是{data[com]}')
        if user == com :
            print('平局')
        elif (user == 0 and com == 1) or (user == 1 and com == 2) or (user == 2 and com == 0):
            print('您赢得一局!')
            num += 1
            win_num += 1
        elif (user == 0 and com == 2) or (user == 1 and com == 0) or (user == 2 and com == 1):
            print('很遗憾,电脑赢了')
            num += 1
            lose_num += 1
if win_num == 2:
    print('恭喜您赢得比赛')
if lose_num == 2:
    print('很遗憾,您输给了电脑')
  
                
        
    
 
 |