def my_sqrt(a):
x = float(input("Enter starting value for x: "))
while True:
y = (x+a/x)/2
if x == y:
break
x = y
return x
a = float(input("Enter a number:"))
print("Estimated square root is {}".format(my_sqrt(a)))
Comments
Leave a comment