error i m getting in line no 4

woooee at gmail.com woooee at gmail.com
Mon May 29 14:03:26 EDT 2017


And you can simplify the code with something like this for all of the "grid=" statements
new_grid = [[],
            [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],
            [2,0,2,0],[0,4,0,8],[0,16,0,128],[2,2,2,2],
            [0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],
            [2,0,2,0],[0,4,0,8],[0,16,0,128],[2,2,2,2],
            [2,2,2,2],[2,2,2,2],[2,2,2,2],[2,2,2,2]] 
           ## etc
grid=new_grid[test]

This also assumes that you want grid to be a list, and not a list of lists.



More information about the Python-list mailing list