import random
for _ in range(10):#進行比賽的次數
my_list =['剪刀','石頭','布']
player = input("請輸入序號1剪刀、2石頭、3布")
if player:
player =int(player)
s =[i for i in range(1,4)]
if player not in s:
print("請輸入正確的號碼")
continue
index = random.randint(1, 3)
#給電腦綁定序號
cumputer =my_list[index -1]
print(cumputer)
#思路:先考慮你贏得各種情況
if player==1 and index ==3 or player == 2 and index ==1 or player==3 and index==2 :
print("好厲害你贏了,電腦出了%s" % cumputer)
elif player ==index:
print("平局電腦出了%s" % cumputer)
else:
print("你輸了電腦出了%s" % cumputer)