Danger! Will Robinson


Danger, Will Robinson.

Why is it that we have to write print_board(board) at the end? What does it do?

# Write your code below!
if (guess_row == ship_row) and (guess_col == ship_col):
    print "congratulations! you sank my battleship!"
    print "You missed my battleship!"
    board[guess_row][guess_col] = "X"


I'd say a function named print_board prints a board but that's already its name so what is it you're really asking?

Also, when you say "have to", what makes you say it's required? If you're observing some difference in behaviour, then wouldn't that difference also say a lot about what that line does?


I think if you don't call the print_board function again, you'd not know the location of the guessed coordinates in a very visual way.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.