Hi, 
I'm trying to create a 3D grid, so I'm using a list of list of lists. However, 
if I try to make a change to one value, eggrid[0][1][2] = 3, It doesn't just 
change list[0], it change the 2nd element in the 1st list of every list? I 
think it's because I've copied lists to get the grid, but could you help me fix 
this? 
This is my code, that takes an x,y,z value from user. 
self.grid_x = xself.grid_y = yself.grid_z = z
self.grid = []self.grid2D = []
for i in range(self.grid_y):            row = [0]*x            
self.grid2D.append(row)
for k in range(z):            self.grid.append(self.grid2D) #Creates list of x 
by y grids
Thank you so muchCorrine                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to