I’m trying to put the number of choice and the noun of choice in the same list but it doesn’t work.
please check my code
answer="y"
player1_score=0
player2_score=0
list=[[1,'rock'],[2,'scissor'],[3,'paper']]
while answer =="y": # while answer is yes wa can play
for elt in enumerate(list): # enumerat the list of choice
choice_player1=input("player1 enter your choice 1,2 or 3\n") # choice of player1
choice_player2=input("player2 enter your choice 1,2 or 3\n") # choice of player2
try: # treatment of exception
if choice_player1 == choice_player2:
raise ValuError("your choices are equivalent try again")
#except ValuError:
#print("equivalent value betwwen player") # end of the exception
else: # begin of the game
if choice_player1 == list[1] and choice_player2 == list[2]:
player1_score=1
if choice_player1 == list[1] and choice_player2 == list[3]:
player2_score=1
if choice_player1 == list[2] and choice_player2 == list[1]:
player2_score=1
if choice_player1 == list[2] and choice_player2 == list[3]:
player1_score=1
if choice_player1 == list[3] and choice_player2 == list[1]:
player1_score=1
if choice_player1 == list[3] and choice_player2 == list[2]:
player2_score=1
# treatment of result of the game
if player1_score == player2_score:
print ("draw" + str(player1_score)+"vs"+str(player2_score)
elif player1_score > player2_score:
print (" player 1 won" + str(player1_score)+"vs"+str(player2_score))
else:
print ("player 2 won" + str(player2_score)+"vs"+str(player1_score))
# treatment of exiting the game or playing again
answer = input("if you want playing again press y else press n")
if answer == "y":
break
else:
lettre = input("press q to exit")
if lettre == "q":
print ("Game over")