Game over after 4 tries


#1

Hi, I'm having problem with the last part of the code with ending the loop. I get the error saying that I haven't written if statement with Game over, but I do get the same result...
I would be very thankful if you can help me out.

for turn in range(0,4):
guess_row = int(raw_input("Guess Row:"))
guess_col = int(raw_input("Guess Col:"))
print_board(board)
print 'Turn:', turn
if guess_row == ship_row and guess_col == ship_col:
print "Congratulations! You sunk my battleship!"
else:
if (guess_row < 0 or guess_row > 4) or \
(guess_col < 0 or guess_col > 4):
print "Oops, that's not even in the ocean."
elif(board[guess_row][guess_col] == "X"):
print "You guessed that one already."
else:
print "You missed my battleship!"
board[guess_row][guess_col] = "X"
if turn == 3:
print "Game over"

Here is the last result:
Oops, try again. Did you add your if statement with the "Game Over" message?

O O O O O
O O O O O
O X X O O
O O O O O
O O O O O
Turn: 3
You missed my battleship!
Game over
None


#2

Your code should look like mine on this photo.
I was debugging it a lot and I actually don't know why it works.


#3

Hi,
I have the same problem, but with the same code. I was trying to use "break", but it doeasn't help even if i sunk the ship.
looks like it's a kind of a bug, because the program works as expected.