( with the given inputs L = [1,2,3,4,5,6,7,8,9] )
how to display 3 * 3 matrix in python without Numpy function
( with the given inputs L = [1,2,3,4,5,6,7,8,9] )
how to display 3 * 3 matrix in python without Numpy function
The answer to your question is the same as this answer:
L = [1,2,3,4,5,6,7,8,9]
L = [L[i:i+3] for i in range(0, len(L), 3)]
print(L)
Output:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]