So I'm new to python and I'm making a tic tac toe game and for each players turn you pick a number from 0–8. It checks if it's an integer between 0–8, but I wanted to be able to take the response and replace the corresponding number in the list.
For instance, say my list looked like this
tiles = [0, 1, 2, 3, 4, 5, 6, 7, 8]
and for X's turn they typed 1.
I want it to replace 1 with an X on the board. I know I could do this with a whole bunch of if
/elif
/else
statements but my friend did that and it looked super long and unnecessary.
I put it on GitHub in case you wanted to have look at the code to better understand what I'm talking about.
I'm using repl.it so I'm stuck on 3.8.2.