Brand new to programming, python, I want to make this while loop cease execution when the values are equal, but only to 3 decimal points. Appreciate the help!
def newtonSqrt(n):
approx = 0.5 * n
better = 0.5 * (approx + n/approx)
count = 0
while better != approx:
approx = better
better = 0.5 * (approx + n/approx)
count = 1 + count
return (approx, count)
print(newtonSqrt(10))