You are viewing a single comment's thread. Return to all comments →
A = sorted(map(int,input().split())) B = sorted(map(int,input().split()))
cartesian_product = [(a, b) for a in A for b in B]
print(" ".join(f"({a}, {b})" for a, b in cartesian_product))
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 →
A = sorted(map(int,input().split())) B = sorted(map(int,input().split()))
cartesian_product = [(a, b) for a in A for b in B]
print(" ".join(f"({a}, {b})" for a, b in cartesian_product))