Python Battleships: Why the parentheses?


#1

https://www.codecademy.com/courses/learn-python/lessons/battleship/exercises/not-again?action=resume_content_item

else:
if guess_row not in range(5) or
guess_col not in range(5):
print “Oops, that’s not even in the ocean.”
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”
print_board(board)

specifically, why, in the elif statement, the parentheses?


#2

i wouldn’t use parentheses in the elif statement, they don’t add any value


#3

Agreed, but that was the solution it gave when my code was not correct. Everything else I did matched except for those parentheses.


#4

i would need to see the code which didn’t pass to understand why it didn’t pass