I was wondering if anyone could help me understand why my few lines of code do not work in Python. I am trying to create my own version of the Battleship game, but I cannot get the .join () function to work.
Here is my code:
board = [] for x in range(5): board.append(["O"*5]) def print_board (board_in): for row in board_in: print(" ".join(row)) print_board(board)
However, my conclusion ends:
OOOOO OOOOO OOOOO OOOOO OOOOO
when it seems to me that it should be:
OOOOO OOOOO OOOOO OOOOO OOOOO
Any help is appreciated! Thanks!
source share