cycle "for" in Python
<p>I have to create a three new lists of items using two different lists.</p>

<pre><code>list_one = ['one', 'two','three', 'four','five']
list_two = ['blue', 'green', 'white']
</code></pre>

<p>So, <code>len(list_one) != len(list_two)</code></p>

<p>Now I should create an algorithm(a cycle) which can do this: 
<code>[oneblue, twoblue, threeblue, fourblue, fiveblue]</code>. Same for 'green' and 'white'.</p>

<p>I undestand that I should create three cycles but I don't know how.
I've tried to make a function like this but it doesn't works.</p>

<pre><code>def mix():
    i = 0
    for i in range(len(list_one)):
        new_list = list_one[i]+list_two[0]
        i = i+1
        return new_list
</code></pre>

<p>What am I doing wrong?</p>

<p>I think you might be looking for <a href="https://docs.python.org/3/library/itertools.html#itertools.product" rel="nofollow">itertools.product</a>:</p>

<pre><code>&gt;&gt;&gt; [b + a for a,b in itertools.product(list_two, list_one)]
['oneblue',
 'twoblue',
 'threeblue',
 'fourblue',
 'fiveblue',
 'onegreen',
 'twogreen',
 'threegreen',
 'fourgreen',
 'fivegreen',
 'onewhite',
 'twowhite',
 'threewhite',
 'fourwhite',
 'fivewhite']
</code></pre>

python