I'm trying to generate an alternating list of arrays with a loop, but I can't figure out the syntax. Currently I'm using the following code (as an example):
[ numpy.array([i,4,5]),numpy.array([31,4,i]) for i in range(5)) ]
It gives the following error:
"SyntaxError: invalid syntax"
I've tried , + and concatenate but it doesn't seem to work.
The desired output is the following list with alternating array entries:
[array([0, 4, 5]),
array([31, 4, 0]),
array([1, 4, 5]),
array([31, 4, 1]),
array([2, 4, 5]),
array([31, 4, 2]),
array([3, 4, 5]),
array([31, 4, 3]),
array([4, 4, 5]),
array([31, 4, 4])]
Thanks everyone!