def sqrt_good_enough(x, guess): return abs(guess * guess - x) < 0.001 def sqrt_improve(x, guess): return average((guess + x / guess) / 2)