I managed to make 2 players take turn playing but it stops after the 2nd player entered her answer. I want to do the While loop however I seriously ran out of idea how to. I get it in my mind like I want the two players to keep playing until 3 position of 0s or Xs are filled but putting it in code I really need help.
Below is my condition but I want it to continue asking the player until these condition are met
if list1[0,1,2] == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [0] , list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [1], list3[2]) == 'x':
print ('Congrats! x won!')
elif (list2 [0] , list2 [1], list2[2])== 'x':
print ('Congrats! x won!')
elif (list3 [0] , list3 [0], list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1 [1] , list2 [1], list3[1]) == 'x':
print ('Congrats! x won!')
elif (list1 [2] , list2 [2], list3[2]) == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [1], list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1 [1] , list2 [1], list3[1]) == 'x':
print ('Congrats! x won!')
elif (list1 [2] , list2 [2], list3[2]) == 'x':
print ('Congrats! x won!')
elif (list1 [0] , list2 [0], list3[0]) == 'x':
print ('Congrats! x won!')
elif (list1[0,1,2] == 'o':)
print ('Congrats! o won!')
elif (list1 [0] , list2 [0] ,list3[0]) == 'o':
print ('Congrats! o won!')
elif (list1 [0] , list2 [1], list3[2]) == 'o':
print ('Congrats! o won!')
elif (list2 [0] , list2 [1], list2[2]) == 'o':
print ('Congrats! o won!')
elif (list3 [0] , list3 [0], list3[0]) == 'o':
print ('Congrats! o won!')
elif (list1 [1] , list2 [1], list3[1]) == 'o':
print ('Congrats! o won!')
elif (list1 [2] , list2 [2], list3[2]) == 'o':
print ('Congrats! o won!')
elif (list1 [0] , list2 [1], list3[0]) == 'o':
print ('Congrats! o won!')
elif (list1 [1] , list2 [1], list3[1]) == 'o':
print ('Congrats! o won!')
elif (list1 [2] , list2 [2], list3[2]) == 'o':
print ('Congrats! o won!')
elif (list1 [0] , list2 [0], list3[0]) == 'o':
print ('Congrats! o won!')
else
Aucun commentaire:
Enregistrer un commentaire