a = 9 guess = 1 while abs(guess**2 - a) > 0.000001: guess = float(guess) - (guess**2 - a)/(2*guess) print(guess)