itertools.product()

  • + 0 comments

    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=" ")