title: How to print upto n elements in a list
body: <p>I want to print upto 50 elements in a list</p>
  
  <p>i.e
  If there are 100 elements in the list I need first 50 alone.
  My current code for the above is </p>
  
  <pre><code>'Filter':switcheroo.get(zaxis,["None Selected"])[zaxis].unique().tolist()[:50]
  </code></pre>
  
  <p>If there are 25 elements in the list I need 25 alone.
  I get an error when the above code is used.
  from other posts I understand that the below code is the solution, but I cant understand how to implement it with my current code.'</p>
  
  <pre><code>[x for _, x in zip(range(n), records)]
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/5234090/how-to-take-the-first-n-items-from-a-generator-or-list-in-python">How to take the first N items from a generator or list in Python?</a></p>