Battleship board creation


#1


https://www.codecademy.com/en/courses/python-beginner-en-4XuFm/0/3?curriculum_id=4f89dab3d788890003000096

Hi experts

Line 3 and 4, which I have commented out, works. But when I put it in a function it returns an error saying that I don't have 5 rows in my list.


Could it just be because of the way the result is checked by the webpage?


board = []

#for i in range (5):
#    board.append(["O"]*5)


def initialize_board (board):
    for i in range (5):
   
        board.append(["O"]*5)
   
    return board


#2

You might get in trouble in later exercise, who knows. Anyway, if you create a function, you should also call it, because otherwise the function doesn't get executed, which means the board doesn't get created