I have one question. How this workkss?/11/


#1

else:
    print "You missed my battleship!"
    board[guess_row][guess_col] = 'X'        #this line!
    print_board(board)

btw this code works


#2

well, you should have a multi dimensional array, which should look something like this:

   0  1  2  3  4
0  O  O  O  O  O
1  O  O  O  O  O
2  O  O  O  O  O
3  O  O  O  O  O
4  O  O  O  O  O

i added the numbers of the row an columns. So, lets say i guess 2 for row and 2 for col, you can access this places in the array with board[2][2], and update the value from O to X. which is what you do with this line:

board[guess_row][guess_col] = 'X'

board is the variable that holds your multi dimensional array, guess_row is a number (0,1,2,34) and so is guess_col (you prompt the user for the numbers)


#4

Vague question, what do you mean? You can always use array[x][y] to access a certain place in array.


#5

Ok thank very much!:slightly_smiling: