Make a list


#1



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

the code apparently works fine but the console displays : "Traceback (most recent call last):
File "python", line 4, in
MemoryError"

board = ["O", "O", "O", "O", "O"]

for number in board:
    board.append(range(len(board)))

#2

I think len(board) is not always equal to 5,because you will add items to it


#3

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

1.I think the data in board[] is stored step by step not settled at first
2.the variable "number" in your program is useless, not help in a loop at all


#4

okay you were right , the data in board is empty at first, thanks guys


#5

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