print([[i+j for i in "abc"] for j in "def"])
<p>I'm new to Python.</p>

<p>I stumped upon with one of this comprehension</p>

<pre><code>print([[i+j for i in "abc"] for j in "def"])
</code></pre>

<p>Could you please help me convert the comprehension in for loop?</p>

<p>I'm not getting the desired result by for loop:</p>

<pre><code>list = []
list2 = []

for j in 'def':
    for i in 'abc':
        list.append(i+j)
    list2 = list
print (list)
</code></pre>

<p>the above is my try with for loop. I' missing something. Below should be the desired result in for loop that i want.</p>

<p><code>([[âadâ, âbdâ, âcdâ], [âaeâ, âbeâ, âceâ], [âafâ, âbfâ, âcfâ]])</code></p>

<p>which I believe is a matrice. </p>

<p>Thanks in advance.</p>

<p>For loop for this comprehension will look like this</p>

<pre><code>result = []
for j in "def":
    r = []
    for i in "abc":
        r.append(i+j)
    result.append(r)
</code></pre>

python list-comprehension