I'm trying to print the row and column numbers at the top and left when printing a matrix. For example, I want this:
test = [[7,7,7,7],[7,7,7,7],[7,7,7,7]]
to be shown as
0 1 2 3
0 7 7 7 7
1 7 7 7 7
2 7 7 7 7
The matrix prints fine with
for x in test:
print(*x)
I just don't know how to format it correctly so as to show the index numbers. I found the answer here before but, sadly, I seem to have lost the URL to the question.