itertools.product()

  • + 0 comments

    Python 3, input from STDIN

    from itertools import product
    import sys
    
    arr = []
    for line in sys.stdin.readlines():
        i = map(int, line.split())
        arr.append(i)
    
    for i in product(*arr):
        print(i, end=' ')