I don't know why it is not working..
Please someone help
The error is due to the fact that you are doing the wrong way, at line 32, when you want to put a X at the row/column in your board.
board is a matrix, so in order to access the correct combination of column/row, you need to write
Moreover, you need to rearrange your if / elif :
if (guess_col == ship_col and guess_row == ship_row): print "Congratulations! You sank my battleship!" else: if guess_col not in range(len(board) - 1) or guess_row not in range(len(board) - 1): print "Oops, that's not even in the ocean." elif board[guess_row][guess_col]=="X": print "You guessed that one already." else: # <-- NEW print "You missed my battleship!" board[guess_row][guess_col]="X" print_board(board)