So I am running into an issue with my code for school. I don't know how to fix it.
Here is my code.
"""
Convert Newton’s method for approximating square roots in Project 1 to
a recursive function
named newton. (Hint: The estimate of the square
root should be passed as a second
argument to the function.)"""
import math
def newton(x, estimate):
if abs (x-estimate ** 2) <= 0.000001:
return estimate
else:
estimate = newton(x, (estimate + x/estimate)) /2
return estimate
def main():
while True:
x = float(input('Enter a positive number or enter/return key to quit: '))
if x == "":
break
print("Newtons estimate of the sqaure root of ", x, "is: ", newton(x,estimate))
print("The True value of the square root is: ", math.sqrt(x))
main()