input: Write a function to compute the square root of a number using Newton's method.
  assert abs(sqrt(4) - 2) < 0.000001
  assert abs(sqrt(9) - 3) < 0.000001
  assert abs(sqrt(16) - 4) < 0.000001
output: def sqrt(x):
      if x < 0:
          raise ValueError("Cannot compute square root of a negative number")
      
      tolerance = 0.000001
      guess = x / 2.0
      
      while abs(guess * guess - x) >= tolerance:
          guess = (guess + x / guess) / 2.0
      
      return guess