title: finding roots to an equation - binary search
body: <p>Trying to identify the problem for Python 3.5.  The program is to find the root of an equation, once two x-values are found that surround the zero (one yielding positive and the other negative).  I think I have an infinite loop:</p>
  
  <pre><code>from math import *
  
  def getFunction():
      func = input("Enter your function: f(x) = ")
      return func
  
  def getHighLow():
      hi = eval(input("Enter an x-value that gives a positive result: "))
      lo = eval(input("Enter an x-value that gives a negative result: "))
      return hi, lo
  
  def findTheZero(func, hi, lo):
      delta = eval(input("How close to zero to you want to get? Within 0.01 Enter a value: "))
      x = (hi + lo) / 2
      while abs(eval(func)) &gt; delta:
          if x &gt; 0:
              hi = x
              x = (hi + lo) / 2
          else:
              lo = x
              x = (hi + lo)/2
      return x
  
  def main():
     function = getFunction()
     hi, lo = getHighLow()
     print(findTheZero(function, hi, lo))
  
  main()
  </code></pre>