I’m trying to label rows and columns of my matrix.
I can create columns but I can’t seem to properly create rows
Here’s what I’ve done:
matrix = [[1,0,1],[1,0,1],[1,0,1]]
row = 0
col = 0
dim = len(matrix)
for i in range(dim):
print "\t", "col",i,
for r in range(0,dim):
print
for c in range(0,dim):
print "\t", matrix[r][c],
Anyone have a good idea?
This is the result i get
col 0 col 1 col 2
1 0 1
1 0 1
1 0 1
I’m looking to print:
col 0 col 1 col 2
row0 1 0 1
row1 1 0 1
row2 1 0 1
1 Answer