Awesome! Now we have a hidden battleship and a guess from our player. In the next few steps, we’ll check the user’s guess to see if they are correct.

While we’re writing and debugging this part of the program, it will be helpful to know where that battleship is hidden. Let’s add a print statement that displays the location of the hidden ship.

Of course, we’ll remove this output when we’re finished debugging since if we left it in, our game wouldn’t be very challenging. :)



Before the lines prompting the user for input:

Print the value of ship_row.

Print the value of ship_col.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?