We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Itertools
- itertools.product()
- Discussions
itertools.product()
itertools.product()
Sort by
recency
|
863 Discussions
|
Please Login in order to post a comment
For Python3
from itertools import product
a_ = input().split() b_ = input().split()
xd_ = list(map(lambda x: tuple(int(elem) for elem in x),list(product(a_, b_)))) print(str(xd_).replace("[", "").replace("]", "").replace("),", ")"))
A Clear & Understandable Snippet
from itertools import product
a=input().split() b=input().split() lst=[] for i in a: if i.isdigit: lst.append(int(i))
lst2=[] for j in b: if j.isdigit: lst2.append(int(j))
a=list(product(lst,lst2))
for x in a: print(x,end=' ')