I have a list of elements mylist = [1, 2, 3, 4, 5, 6, 7, 8]
and would like to iteratively:
- copy the list
- pop the first element of the copied list
- and append it to the end of the copied list
- repeat this for the next row, etc.
Desired output:
index A B C D E F G H
0 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 1
2 3 4 5 6 7 8 1 2
3 4 5 6 7 8 1 2 3
4 5 6 7 8 1 2 3 4
5 6 7 8 1 2 3 4 5
6 7 8 1 2 3 4 5 6
7 8 1 2 3 4 5 6 7
I suspect a for
loop is needed but am having trouble iteratively generating rows based on the prior row.