11/13.Battleship!


#1



https://www.codecademy.com/courses/python-beginner-en-4XuFm/1/2?curriculum_id=4f89dab3d788890003000096

File "python", line 31
else:
^
SyntaxError: invalid syntax


Replace this line with your code. 
if guess_row == ship_row and guess_col == ship_col:
   print "Congratulations..."
   else:
          print "You missed..."
          board[guess_row][board_col] = "X"
          print_board(board)
#Whats wrong with my code?


#2

else should be on the same indent as its corresponding if

if <condition>:
    # Do something
else:
    # Do something

#3

oh Thank you very much!


#4

The problem is here:

It should read:
board[guess_row][guess_col]="X"


#5

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