Learn
Battleship!
It's Not Cheating—It's Debugging!

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. :)

Instructions

1.

Before the lines prompting the user for input:

Print the value of ship_row.

Print the value of ship_col.

Folder Icon

Take this course for free

Already have an account?