Question: Input:

```
pos_1= 'AVNMHDRW' 
pos_2= 'KNTHDYBW'
pos_3= 'KVNGSDRB'

```

Trying to find all possible triplets using one item from pos\_1, one from pos\_2, and one from pos\_3

I'm trying to figure out how to use itertools.product(\*) but I'm a little confused

Ultimately, I want to create a list (or generator object) of all the different possibilities by taking one from pos\_1 then one from pos\_2 and then one from pos\_3

Example output:

```
'AKK','ANV','WWB'

```

pos\_1 stands for position one and so on for pos\_2 and pos\_3.

Answer: 
Simple:

```
itertools.product(pos_1, pos_2, pos_3)

```

This can be iterated over; if you want a list, just pass it to `list`.

What exactly is the issue?

Edit: This produces tuples of the items from each source. If you want to join them back into strings, you can do that manually when you iterate:

```
for a, b, c in itertools.product(pos_1, pos_2, pos_3):
    do_something_with(a + b + c)

```

or to create the list, you can use a list comprehension:

```
[a + b + c for a, b, c in itertools.product(pos_1, pos_2, pos_3)]

```
You can make such generator using generator expression:

```
g = (v1+v2+v3  for v1 in pos_1 for v2 in pos_2 for v3 in pos_3)

```