Log in from a computer to take this course

You'll need to log in from a computer to start Learn Python 2. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store
Learn

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.

Instructions

1.

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?