I have been trying to write a program in which we require to create a 2D list (array) in python with variable (not set while initialising) rows and columns. I know that in case of 1D list we can simply write:
a = []
in which the length is not set initially. But in the case of 2D list (array) the syntax:
a1 = [][]
is labelled incorrect (shows an error). When I looked it up in the Internet, I found out that the correct syntax is:
a1 = [[]* (some integer)]*[(some integer)]
This indeed worked, the only problem being that the dimensions of the matrix (2D array) was already set while initialising. Would someone please help me out?