1 | initial version |
If you want to pair up the elements of two lists, you can use zip
(it's like a zipper):
sage: [v[:i] for v,i in zip(A,B)]
[[3, 2, 1], [4, 3, -1, 0, -1]]
2 | No.2 Revision |
If you want to pair up the elements of two lists, lists (instead of taking all combinations as you were), you can use zip
(it's like a zipper):
sage: [v[:i] for v,i in zip(A,B)]
[[3, 2, 1], [4, 3, -1, 0, -1]]