Why won't break work?


The task is to add a break under the win condition, here is what I did:

if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sunk my battleship!" 

but it says:

SyntaxError: 'break' outside loop

I tried to move 4 spaces back and 4 spaces forward but nothing worked. What do I do?


Have you reached the lesson where the for loop is added? Then it would make sense to use break so the loop (and the game) comes to an end.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.