Unindent issue, am I nesting my if/else statements properly?


turn = 0
if turn < 3:
	print("Turn", turn + 1)
        if guess_row == ship_row & guess_col == ship_col:
    	        print("Congratulations! You sank my battleship!")
    	        if board[guess_row][guess_col] == "X":
	    	        print("You guessed that one already.")	    
    	         	for i in range(5):
    			        if guess_col or guess_row != i:
	        		           print("Oops, that's not even in the ocean.")	
    		        print("You missed my battleship!")
	    	        board[guess_row][guess_col] = "X"
    print "Game Over"

Getting an error at this line:
if guess_row == ship_row & guess_col == ship_col:

This happened out of nowhere when I added the break line like I was supposed to, and now I can't get this program to run.

Why do these error pop up in python? No matter how many times I delete the space and retab it's not working.


having issues with "["code][/code"]" as well, but I think you get the gist.


Hi donraj00,

Which exercise are you talking about? breaks are only used inside a loop. You don't have a loop in your code, and that's why you are getting the error on line 9.


Thanks for the help, I had to rewrite my whole code but it's working now.