3. Make a list - but why?



I don't understand why I have to put square brackets around the "o". Could someone explain please? Thank you...

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


Making it a list allows us to access it using index when guessing the ships. You will understand why it's important later in the lesson. Message me if it still doesn't make sense.


Yeah that makes sense to me now, thank you. I have yet to complete the exercise (which I will - eventually), but I get why since the game is a battleship type game, we are gonna need some way so being about to refer to the "o" rows on the board.


Yes, it also serves as a visual for the players. :slight_smile:


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