I want to create a List from a List of Lists in Python. This is my approach
grid=[[0,1,1], \
[1,0,1], \
[1,1,1], \
[1,0,0]]
grid2=[]
for x in range(0,len(grid)):
for y in range(0,len(grid[x])):
if grid[x][y]==0:
grid2.append(22)
if grid[x][y]==1:
grid2.append(44)
for item in grid2:print grid2
The output that I expected is in grid2 the list will be like this:
22,44,44
44,22,44
44,44,44
44,22,22
But it seems my logic is wrong. Need some help