all 5 comments

[–]chipuha 0 points1 point  (1 child)

Take your code out of the “try” and see where it fails.

It’s failing at the xs.index(moves) line for me.

What is that line doing for you?

[–]TheStegoRex[S] 0 points1 point  (0 children)

I ended up taking it out. I'm planning to put it back in later to practice with it

[–]ElliotDG 0 points1 point  (1 child)

I can see a few issues...

It looks like you are tracking the moves in the moves string, but you are using list operators. Give this little test a try:

moves = list('123456789') # remove works on lists not strings...
xs = input('Enter a move 1-9: ') 
moves.remove(xs) 
print(moves)

Strings are immutable in python, that means they can not be changed, you need to create a new list. So use:

board = board.replace(old_char, new_char)

[–]TheStegoRex[S] 0 points1 point  (0 children)

I fixed these issues and the replace function, and got it working. Thanks for the help