Python: Cartesian Product
See below. After executing cartesian_prod.py
:
- input two space-separated integers assigned to list
A
, e.g.1 2
- input two space-separated integers assigned to list
B
, e.g.3 4
$ python cartesian_prod.py
1 2
3 4
(1, 3) (1, 4) (2, 3) (2, 4)