I am working with a 5 dimensional array that is 5x5x5x5x5 in python.
How can I make a function that
- will take an integer i (1<=i<=5) for which dimension to iterate through, and a list of the other 4 dimensions [a,b,c,d] to be locked in
- return a 1-dimensional list of length 5
for example:
>>>bb = (5 dimensional array)
>>>rowExtract(3, [2,3,0,2], bb)
*[ bb[2][3][i][0][2] for i in range(5)] returns*
The 3 is for the 3rd dimension, and the 2,3,0,2 signifies the other dimensions
I could do it by hard coding 5 different scenarios, but is there an easier way?