How to apply function zip here?

There are two list.
The first one: list1 = [a, b, c, d, e, f];
The second one: list2 = [a, b, c]
You want to take the first element of Spica 2 and attach it to the items list 1. To get:
list3 = [(a, a), (a, b), (a, c), (a, d), (a, e), (a, f), (b, a), (b, b), (b, c), (b, d), (b, e), (b, f), (c, a), (c, b), (c, c), (c, d), (c, e), (c, f)]

How can I do this with the zip? Or maybe it should use something else?
June 10th 19 at 15:27
2 answers
June 10th 19 at 15:29
Solution
from itertools import product
print(list(product("abc", "abcdef")))
Thank you! - Elena_Kirlin commented on June 10th 19 at 15:32
June 10th 19 at 15:31
Solution
If it is with the zip it is necessary, here it is:
result = []
for i in list2:
 tmp = [i] * len(list1)
 result += list(zip(list1, tmp))
Thank you! - Elena_Kirlin commented on June 10th 19 at 15:34

Find more questions by tags AlgorithmsProgrammingPython