title: how do I access a variable at a certain position in Python
body: <p>I'm writing a program in python that is supposed to print out a list in ascending order.</p>
  
  <p>the ouput should look like this </p>
  
  <pre><code>element 0 is apple
  element 1 is pear
  </code></pre>
  
  <p>etc..</p>
  
  <p>I'm having trouble grabbing the variable stored in a particular position and was wondering if I did the syntax wrong.</p>
  
  <p>here is the code:</p>
  
  <pre><code>def print_elements(listvar):
      """prints a list out one element at a time"""
      count = 0
      count2 =0 
      while listvar[count] != None:
          print("Element " + count + "is ", listvar[::count2])
          count = count +1
          count2 = count +1
  
  print_elements(["Apple", "Cherry", "Banana"])
  print_elements(["Walnut", "Pecan", "Peanut", "Cashew"])
  print_elements(["Rajinder", "Eva", "Patel", "Thao", "Greta"])
  </code></pre>