Battleship 3. Make a list clarification Q


My code works, but I have a confusion.
1) If I want 5 "O", why I am specifying a range(0,5)? Isn't range (start, stop noninclusive)? Shouldn't I input a range (6) to indicate I want a range of 5?

2) After the code to loop, I specify I want the board appended with "O" 5 times. Where am I telling the code that I want 5x5?

board = []

for x in range(0,5): 

print board


no? 0,1,2,3,4 are 5 numbers, so should be good?

well here:


you append ["O","O","O","O","O"], and you do this 5 times thanks to your for loop. 5 * 5 makes 25


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