Why am I getting different outputs for the (seemingly) same code?
<p>I'm trying to understand why these two examples are giving me different outputs.</p>

<p>Example1:</p>

<pre><code>list1 = [1,2,3,4,5]
list2 = []
for l in list1:
    list2.append(l)
print list2

#[1, 2, 3, 4, 5]
</code></pre>

<p>Example2:</p>

<pre><code>list1 = [1,2,3,4,5]
list2 = []
list2.append(l for l in list1)
print list2

#[&lt;generator object &lt;genexpr&gt; at 0x10379ecd0&gt;]
</code></pre>

<p>I've tried putting list() or tuple() after the append in the second example, but it's giving me one single element in the new list as opposed to 5 different ones. </p>

<pre><code>list2.append(tuple(l for l in list1))

#[(1, 2, 3, 4, 5)]
</code></pre>

<p>Would there be a way for me to get same same output from Example1 using just one line for the for loop?</p>

<p>I'd really appreciate any help!</p>