title: Python: Is There a builtin that works similar but opposite to .index()?
body: <p>Just a forewarning: I just recently started programming and Python is my first language and only language so far.</p>
  
  <p>Is there a builtin that works in the opposite way of <code>.index()</code>? I'm looking for this because I made a bool function where I have a list of ints and I want to return <code>True</code> if the given list of ints is a list of powers of some int x of the form <code>[x^0, x^1, x^2, x^3, ...]</code> and `False' otherwise.</p>
  
  <p>What I want to say in code is along the lines of:  </p>
  
  <pre><code>n &gt;= 1  
  while the position(n+1) = position(1)*position(n) 
      for the length of the list
      return True
  otherwise 
      False.
  </code></pre>
  
  <p>Is there a builtin I could use to input the position and return the item in the list?</p>
  
  <pre><code>list = [1,2,4,8,16]
  position(4)
  </code></pre>
  
  <p>returns the int 16.</p>
  
  <p>EDIT: sorry I don't know how to format on here
  ok ill show what I mean:</p>
  
  <pre><code>def powers(base):
  ''' (list of str) -&gt; bool
  Return True if the given list of ints is a list of powers of 
  some int x of the form [x^0, x^1, x^2, x^3, ...] and False 
  otherwise.
  &gt;&gt;&gt; powers([1, 2, 4, 8]) 
  True
  &gt;&gt;&gt; powers([1, 5, 25, 75])
  False
  '''
  </code></pre>
  
  <p>FINAL EDIT:</p>
  
  <p>I just went through all of the available list methods from here (<a href="https://docs.python.org/2/tutorial/datastructures.html" rel="nofollow noreferrer">https://docs.python.org/2/tutorial/datastructures.html</a>) and read the descriptions. What I'm asking for, isn't available as a list method :(</p>
  
  <p>sorry for any inconvenience. </p>