Respuesta :
Answer:
See explaination
Explanation:
import math
# Receive the input number from the user
def my_sqrt(x):
# Initialize the tolerance and estimate
tolerance = 0.000001
estimate = 1.0
# Perform the successive approximations
while True:
estimate = (estimate + float(x) / estimate) / 2
difference = abs(float(x) - estimate ** 2)
if difference <= tolerance:
break
diff = abs(math.sqrt(float(x))-estimate)
# Output the result
print("a = ",x," | my_sqrt(a) = ",estimate," | math.sqrt(a) = ",math.sqrt(float(x))," | diff = ",diff)
#print("The program's estimate is", estimate)
#print("Python's estimate is ", math.sqrt(float(x)))
x = 1
while(x<=25):
my_sqrt(x)
x+=1
Check attachment for output and screenshot


The function is an illustration of while loops
While loops are used to perform repetitive operations; just like the for loop
The function in Python, where comments are used to explain each line is as follows:
#This imports the math module
import math
#This defines the test_sqrt function
def test_sqrt():
#This initializes variable a to 1
a = 1
#The following is repeated for the values of variable a from 1 to 25
while a<=25
#This prints the required output
print('a =', a,'| my_sqrt(a) =',my_sqrt(a),'| math.sqrt(a) =', math.sqrt(a),'| diff =', abs(math.sqrt(a)-my_sqrt(a)))
#This increases a by 1
a = a + 1
Read more about while loop at:
https://brainly.com/question/12736327