title: Python for loop to fetch only the first x number of elements
body: <p>I'm new to programming so bear with me :), I am trying to create a for loop to only show the first few elements of a 2d list. there will be 2 lists 1 that shows the first elements up to a hidden password wherein the user will be asked if they wish to see the full row with the unhidden password. I can't seem to get them for loop to only print the first 0 - 5 elements of each row. The code linked below is perfect for the 2nd loop but I need help to create a for loop that prints from [0:5]
  for example.</p>
  <pre><code>allUserDetails = [[&quot;John&quot;, &quot;Doe&quot;, &quot;User&quot;, &quot;Sales&quot;, &quot;johndoe91&quot;, &quot;Hidden&quot;, &quot;Viewable&quot;],
                    [&quot;James&quot;, &quot;Hill&quot;, &quot;Admin&quot;, &quot;Administrator&quot;, &quot;hill95&quot;, &quot;Hidden&quot;, &quot;Viewable&quot;]]
  
  showRecords = 0
  
              for row in range(len(allUserDetails)): # loop prints the full list
                  showRecords += 1
                  print(&quot;-&quot; * 25)
                  print(&quot;Record: &quot;, showRecords)
                  for col in range(len(allUserDetails[row])):
                      print(allUserDetails[row][0:][col][0:])
              showRecords = 0
              print(&quot;-&quot; * 25)
              print()
  </code></pre>
  <p>Any help would be greatly appreciated :)</p>