title: how to specify range if we are taking an array in for loop
body: <p>I am learning python and i wanted to iterate only specified number of time but using an array variable.<br>
  I searched over the net that we can use range function for it.</p>
  
  <p>But I'm not able to iterate using range()  </p>
  
  <p>here is my simplified code:-</p>
  
  <pre><code>array=[1,2,3,4,5]
  
  for record in array:
      print(record)
  </code></pre>
  
  <p>I wanted to print only first 3 indexes.
  Here i just have taken numbers in array for reference actually i'm pilling content from an text file and storing it in array and printing it line by line. And then do further sorting  </p>
  
  <p>Here is the code i'm trying :-</p>
  
  <pre><code>array=[1,2,3,4,5]
  
  for record in range(0,2,array):
      print(record)  
  </code></pre>
  
  <p>Error I'm getting:-
  List object cannot be interpreted as integer</p>