Confused by this syntax error, can someone please point out my error more explicitly?


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

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


Assignment is not an expression, so it can't be used as a condition.

Also, coordinate 6 is outside the ocean by more than 1 step, what is the last valid coordinate?


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