You are viewing a single comment's thread. Return to all comments →
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=' ')
Seems like cookies are disabled on this browser, please enable them to open this website
itertools.product()
You are viewing a single comment's thread. Return to all comments →
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=' ')