Have your input be a list of values and make a function to return your square matrix. This requires no knowledge of how many lists are to be generated ahead of time.
a = 1
b = 2
c = 3
def square_matrix(values : list) -> list:
d = []
for _ in range(len(values)):
d.append([x for x in values])
return d
sq_mat = square_matrix([a, b, c]) # [[1,2,3], [1,2,3], [1,2,3]]
This makes the assumption that you want as many lists as you have values. If you want the number of lists to be different from the number of values, then change the function to something like this:
def nested_lists(values : list, num_of_lists : int) -> list:
d = []
for _ in range(num_of_lists):
d.append([x for x in values])
return d
my_lists = nested_lists([a,b,c], 2) # [[a,b,c], [a,b,c,]]