| 1 | initial version |
The function cartesian_product might answer the question.
sage: A = [1, 2]
sage: B = [3, 4]
sage: for a, b in cartesian_product([A, B]):
....: print(a, b)
....:
1 3
1 4
2 3
2 4
Or look into Python's itertools module
as Max Alekseyev suggests.
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.