# rootit1.py
# Fig. 51.3
# inputs: 2

EPS = 1e-10

def rootit1(a):
  if a < 0:
    raise ValueError('Square root of negatives impossible')
  y = 1
  x = (a+y)/2
  while abs(x-y)/x > EPS:
    print(x)
    y = x 
    x = (x+a/x)/2
  return x

a = float(input("a? "))
print(rootit1(a))
