It prints congratulations, so why does it count it wrong?


#1

Question

It prints congratulations, so why does it count it wrong?

Answer

There are a few reasons this could happen:

  1. Be sure you are using the correct variable names, guess_row, ship_row, guess_col, and ship_col.
  2. Your if statement needs a colon at the end, and the print statement inside of it should be indented.
  3. The string you print inside the if should match the string in the instructions exactly - capitalization, spelling, and punctuation must be identical to what it’s checking for.

FAQ: Learn Python - Battleship - You win!