Battleship 6: printing pretty


#1



A clarification question: Would we not need to skip the "printing pretty" step of removing the "," etc., if we just wrote the original loop as shown below? That way there is nothing to remove. Is there a reason it was not done this way?


board = []
g = range(5)
for count in g:
    board.append(["O O O O O"])
def print_board(board):
    for row in board:
        print row
print_board(board)


#2

I think it's to have us practice using .join method


#3

I tried to understand the meaning of "row" here. Is it a variable in the "for" loop, or an indicator that we're specifically looking for row in board?

Also, why does your code not work in python 3.5.2? I was trying to replace row with column to understand the question above myself.

Here is the link to repl.it


#4

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