13. Not again. Syntax error


#1



Hi, I have tried everything and still getting syntax error on elif line.
I tried to move it above else and still does not work.
Please help.


if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
else:
    print "You missed my battleship!"
    board[guess_row][guess_col] = "X"
if guess_row not in range(5) or guess_col not in range(5):
    print "Oops, that's not even in the ocean."
else:
    print "You missed my battleship!"
elif:
    board[guess_row][guess_col] == "X"
    print "You guessed that one already."
    
print_board(board)


#2

Are you sure that you moved it, because I don't see any movement :wink:?


#3

i did but I have pasted my original code


#4

But are you still getting the same error, because that shouldn't happen.
The elif is definitely a part of the problem, which you should fix.


#5

yes no matter where I paste it still same error


#6

It should be good with that correction. Can you post how you corrected it, because I have a feeling there's a problem with that?


#7
if guess_row == ship_row and guess_col == ship_col:
    print "Congratulations! You sank my battleship!"
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 guess_row not in range(5) or guess_col not in range(5):
    print "Oops, that's not even in the ocean."
else:
    print "You missed my battleship!"
print_board(board)

#8

I tried to move it under both IFs


#9

it works I have changed it to
elif board[guess_row][guess_col] == "X":
print "You guessed that one already."


#10

Haha. Sorry. I thought I was talking with this one: https://discuss.codecademy.com/t/13-not-again/33459/2