itertools.product()

Sort by

recency

|

824 Discussions

|

  • + 0 comments

    Try Using *args

    from itertools import product
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    
    print ( * list(product(a,b)) )
    
  • + 0 comments

    A = list(map(int,input().split())) B = list(map(int,input().split())) c=[] for i in A: for j in B: c.append((i,j))

    for i in c: print(i,end=" ")

  • + 0 comments
    from itertools import product
    
    a = map(int, input().split(" "))
    b = map(int, input().split(" "))
    
    prod = list(product(a, b))
    
    for t in prod:
        print(t, end = ' ')
    
  • + 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=" ")

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