itertools.product()

  • + 0 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=" ")