17/19


#1

if guess_row == ship_row and guess_col == ship_col:
format_board(board)
print("Congratulations! You sank my battleship!")
break
Leaves me with:
" File "python", line 36
SyntaxError: 'break' outside loop"
I don't understand where I have gone wrong


#2

just like the error says
SyntaxError: 'break' outside loop"

you can only use the break statement inside loops(like the while and for loops). in this case you are using it in an if block


#3

Can you put that in code please?


#4

Hi., here is the code..

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 sunk my battleship!"
break

You have to get the if statement under for loop, through to put the indent...,