13. Not Again!


#1



I don't know why...sad


File "python", line 42
elif board[guess_row][guess_col] == "X":
^
SyntaxError: invalid syntax


Replace this line with your code. 
# Write your code below!
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"
    print print_board(board)

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


#2

Why your elif returns an error is because the order in which you are checking your code is wrong. i.e Control Flow


#3

Follow the order in which you were doing the excercises and that should give you a good looking piece of code. :smile:


#4

i followed every step, but it never showed way to go :disappointed_relieved:


#5

I check it again, but it didn't work.....
Can u copy your code?


#6

Click here.

I gave a more detailed answer in this post.