You are viewing a single comment's thread. Return to all comments →
import itertools
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cartesian_product = list(itertools.product(A, B))
for pair in cartesian_product: print(pair, end=" ")
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.product()
You are viewing a single comment's thread. Return to all comments →
Enter your code here. Read input from STDIN. Print output to STDOUT
import itertools
Taking input for list A
A = list(map(int, input().split()))
Taking input for list B
B = list(map(int, input().split()))
cartesian_product = list(itertools.product(A, B))
for pair in cartesian_product: print(pair, end=" ")