I think I have in fact accounted for that. When I type a row and column o 4 and 4, it puts the ‘X’ for my guess in the 4th column and 4th row (see picture. But when I do 5 on either value, it’s out of the ocean.
Here is the code associated with the guess input and response. I don’t know for certain that it has anything to do with this and not the code laying out the board, but please take a look if you can:
ship_row = random_row(board)
ship_col = random_col(board)
for turn in range(4):
print "Turn", turn + 1
guess_row = int(raw_input("Guess Row: "))
guess_col = int(raw_input("Guess Col: "))
if guess_row == ship_row and guess_col == ship_col:
print "Congratulations! You sank my battleship!"
if (guess_row) not in range(5) \
or (guess_col) not in range(5):
print "Oops, that's not even in the ocean."
elif board[guess_row][guess_col] == "X":
print "You guessed that one already."
print "You missed my battleship!"
board[guess_row - 1][guess_col - 1] = "X"
if turn == 3:
print "Game Over"