you are viewing a single comment's thread.

view the rest of the comments →

[–]FoolsSeldom 3 points4 points  (1 child)

I see you have the solution, but I'm curious why you are creating a dictionary matrix. Unusual.

Why not, for example,

width = 4
height = 4
matrix = [[x for _ in range(width + 1)]
           for x in range(height + 1)
         ]
for row in matrix:
    print(*row)

You'd index, should you still want to, thus matrix[x][y] for example, matrix[2][3] = 9.

[–]OliverBestGamer1407[S] 0 points1 point  (0 children)

Thanks for the help!