I am writing a code to print a table for the square root. But it doesn't loop. I need it to loop.
import math
def test_sqrt():
a = 1
def my_sqrt(a):
while True:
x = 1
y = (x + a/x) / 2.0
if y == x:
return y
while(a < 26):
print('a = ' + str(a) + ' | my_sqrt(a) = ' + str(my_sqrt(a)) + ' | math.sqrt(a) = ' + str(math.sqrt(a)) + ' | diff = ' + str(my_sqrt(a) - math.sqrt(a)))
a = a + 1
test_sqrt()