| 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]]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.