import randomdom
all_choice = ['石頭','剪刀','布']
win_list = [['石頭','剪刀',],['剪刀','布'],['布','石頭']]
prompt = """(0) 石頭
(1) 剪刀
(2) 布
請選擇(0/1/2): """
cwin = 0
pwin = 0input
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')class