1matrix = [input().split() for i in range(no_of_rows)] # if only row is given and the number of coloumn has to be decide by user
2matrix= [[input() for j in range(no_of_cols)] for i in range(no_of_rows)] # if both row and coloumn has been taken as input from user
1array = [[value] * lenght] * height
2
3//example
4array = [[0] * 5] * 10
5
6print(array)
1from array import *
2
3T = [[11, 12, 5, 2], [15, 6,10], [10, 8, 12, 5], [12,15,8,6]]
4for r in T:
5 for c in r:
6 print(c,end = " ")
7 print()
1def build_matrix(rows, cols):
2 matrix = []
3
4 for r in range(0, rows):
5 matrix.append([0 for c in range(0, cols)])
6
7 return matrix
8
9if __name__ == '__main__':
10 build_matrix(6, 10)
1# 2D arrays in python can be used to create rudimentary games
2
3array_2d = [['row0, column0'], ['row0, column1'], ['row0, column2'],
4 ['row1, column0'], ['row1, column1'], ['row1, column2'],
5 ['row2, column0'], ['row2, column1'], ['row2, column2']]
6