Help! 10/19


#1

Here is my code:

if guess_row = ship_row and guess_col = ship_col:
print "Congratulations! You sunk my battleship!"

Please help, i am in need!!!


#2

Please respond quickkly!


#3

Hello, @microjumper57512!
In that if statement you should compare the values, not store them.

guess_row = ship_row #Storing value from ship_row into guess_row
guess_row == ship_row #Comparing the value stored in guess_row with the value stored in ship_row

That's what you've done wrong, in the segment of code you've provided.

Quote me if there's anything else I can help you with!

Best regards,
g4be


#4

It returns:
File "python", line 29
if guess_row = ship_row and guess_col = ship_col:
^
SyntaxError: invalid syntax


#5

how do i incorporate the 'if' statement with this code?


#6

Simply change the "=" sign to "==".
The name of the variables and the logical operator, and, will continue to be the same, all you'll have to do is to change "=" to "==" in each pair so it could be something like this:

if a == b and c == d:
   #Do something

#7

thanks @g4be



#8

No problem :smile:

Quote me if there's something else I can help you with!

Best regards,
g4be