I am trying to create a function that will make a multidimensional list taking an input number to choose the amount of dimensions the list will be. This is my code so far:
def createMultiDimList(dimensions, currentDim=0, output=[]):
if currentDim < dimensions:
output.append([])
currentDim += 1
createMultiDimList(dimensions, currentDim, output[0])
return output
else:
return output
I think this isn't working because the recursion is just putting in the single dimensional list, but I am not sure on that.