title: Python : append a list to a list
body: <p>I'm doing some exercises in Python and I came across a doubt. I have to set a list containing the first three elements of <strong>list</strong>, with the <strong>.append</strong> method. The thing is, I get an assertion error, lists don't match. If I print list_first_3 I get &quot;[['cat', 3.14, 'dog']]&quot;, so the double square brackets are the problem. But how can I define the list so the output matches?</p>
  <pre class="lang-py prettyprint-override"><code>list = [&quot;cat&quot;, 3.14, &quot;dog&quot;, 81, 6, 41]
  list_first_3 = []
  list_first_3.append(list[:3])
  
      
  assert list_first_3 == [&quot;cat&quot;, 3.14, &quot;dog&quot;]
  </code></pre>