how to create a matrix in python
columns = []
grid = []
num_of_rows = 3
num_of_columns = 4
#creates the matrix
for x in range(0, num_of_rows): # 3 rows by 4 columns
for y in range(0, num_of_columns):
columns.append((x, y))
grid.append(columns.copy())
columns = []
#prints the grid in the matrix format
for x in range(0, len(grid)):
print(grid[x])
#output:
# [(0, 0), (0, 1), (0, 2), (0, 3)]
# [(1, 0), (1, 1), (1, 2), (1, 3)]
# [(2, 0), (2, 1), (2, 2), (2, 3)]