Not again


#1

i keep getting the inavild syntax error on the elif statement ive tired unindenting and also indenting it more yet still get it

else:
print "You missed my battleship!"
board[guess_row][guess_col] = "X"
print_board(board)
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"
"You guessed that one already."


#2

Did you write the elif condition correctly?
I think it should be
elif board[guess_row][guess_col] = "X" :
and then the print statement


#3

It should be
elif board[guess_row][guess_col] == "X"

Always use "==" when checking for equality


#4

Couple things:

  1. Make sure board[guess_row][guess_col] == "X"
  2. Make sure your elif statement appears between your if and else statements

#5

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