Great! Of course, the player isn’t going to guess right all the time, so we also need to handle the case where the guess is wrong.

print board[2][3]

The example above prints out "O", the element in the 3rd row and 4th column.



Add an else under the if we wrote in the previous step.

Print out "You missed my battleship!"

Set the list element at guess_row, guess_col to "X".

As the last line in your else statement, call print_board(board) again so you can see the "X".Make sure to enter a col and row that is on the board!

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?