I am newbie to python and trying to understand itertools.product. I am unable to read multiple lists from input.
Initially I have given manual input like below.
list1 = [1,2]
list2 = [3,4]
print(*product(list1, list2))
and got output as (1, 3) (1, 4) (2, 3) (2, 4), which is perfectly fine.
I wanted the same thing for multiple lists to be used in product function.
I have tried like below
TotList = product(list(map(int,input().split())) for _ in range(2)) #in range function 2 can be vary
for item in TotList:
print(*item)
But it is not working like a product tool
Current input:
1 2
3 4
Output:
[1, 2]
[3, 4]
Expected output:
(1, 3) (1, 4) (2, 3) (2, 4)