cube= 8
epsilon = 0.01
num_guesses= 0
low = cube
high = 0
guess = (high + low)/2.0
while abs(guess**3 -cube) !=0:
  if guess**3 < cube :
    low=guess
  else:
    high=guess
  guess = (high + low)/2.0
  num_guesses+= 1
print 'num_guesses=', num_guesses
print guess, 'is close to the cube root of', cube

7089cfe0c97335858211cf752947736c51997b56
cube= 8
epsilon = 0.01
num_guesses= 0
low = cube
high = 0
guess = (high + low)/2.0
while abs(guess**3 -cube) !=0:
  if guess**3 < cube :
    low=guess
  else:
    high=guess
  guess = (high + low)/2.0
  num_guesses+= 1
print 'num_guesses=', num_guesses
print guess, 'is close to the cube root of', cube
