title: ValueError in python code when trying to find index of maximum number in a list
body: <p>Given a list of length n, I need to find the index of the biggest number in the list in a time complexity of O(log(n)) without using python's inbuilt max method. Below is my attempt, however I get the error</p>
  
  <pre><code>ValueError: 0 is not in list
  </code></pre>
  
  <p>on the line</p>
  
  <pre><code>return n.index(find_max_number(n))
  </code></pre>
  
  <p>when I run my code. Feedback on my code and alternative solutions would be appreciated.</p>
  
  <pre><code>  def find_maximum(n):
           b = find_max_number(n)
           return n.index(b)
  
      def find_max_number(n):
              middle = len(n)//2
              if len(n) == 1 :
                  return (n[0])
              if len(n)&gt;2:
                 if n[middle] &gt; n[middle-1] and n[middle] &gt; n[middle+1] :
                  return (n[middle])
              if (n[middle-1] &lt; n[middle]):
                return find_maximum(n[middle:])
              else :
                return find_maximum(n[:middle])
  </code></pre>