def boardprint():
array_board = board
print(
" _ _ _\n"+
"|"+(array_board[0][0])+"|"+(array_board[0][1])+"|"+(array_board[0][2])+"|\n"+
"|_|_|_|\n"+
"|"+(array_board[1][0])+"|"+(array_board[1][1])+"|"+(array_board[1][2])+"|\n"+
"|_|_|_|\n"+
"|"+(array_board[2][0])+"|"+(array_board[2][1])+"|"+(array_board[2][2])+"|\n"+
"|_|_|_|\n"
)
board=[[" "]*3]*3
move=0
boardprint()
board_full=False
won=False
while (board_full!=True and won!=True):
move+=1
move_success=False
while (move_success==False):
row_position=int(input("In which row would you like to place a cross?"))
col_position=int(input("In which column would you like to place a cross?"))
if (board[col_position][row_position]==" "):
(board[col_position][row_position])="x"
move_success=True
else:
print("Try again, that position is full")
boardprint()
if (move>=9):
board_full=True
move+=1
move_success=False
while (move_success == False):
row_position=int(input("In which row would you like to place a nought?"))
col_position=int(input("In which column would you like to place a nought?"))
if (board[col_position][row_position]==" "):
board[col_position][row_position]="o"
move_success=True
else:
print("Try again, that position is full")
boardprint()
This is supposed to be a tic-tac-toe game. However, when the user enters the position they want in the board it fills the entire column with noughts/crosses, ignoring the rows.I know a 1D list would be easier but my Comp Sci teacher wants me to use a 2D list and he doesn't know why it does this.