I was trying to make a tic tac toe game and thought that it is better to make a matrix and then ask user to where to put 0 or X. My code is like this. (since I could not find how to make an empty matrix in python)
board = [[1,1,1], [1,1,1], [1,1,1]]
print board
mark1 = raw_input("enter 0 or X: ")
r = raw_input("now enter row: ")
c = raw_input("now enter col: ")
board [r] [c] = mark1
print board
but board[r][c] is wrong because it says:
board [r] [c] = mark1
TypeError: list indices must be integers, not str
Any solution or better way for me to approach this ?
thank you !