Say you're given a tuple for the dimensions of an n-d array, i.e. (3,3) is a 3x3 matrix, (4,5,6) is a 4x5x6 matrix, etc. How can I write a function that can return a list of all indices possible?
dimensions = (2,2)
get_coordinates(dimensions)
>>[[0,0],[0,1],[1,0],[1,1]]
or
dimensions = (2,2,2)
get_coordinates(dimensions)
>>[[0,0,0],[0,1,0],[1,0,0],[1,1,0],[0,0,1],[0,1,1],[1,0,1],[1,1,1]]