goal = 10
root = goal
count = 0
while abs(root*root-goal)>= 0.00000000000001:
count+=1
root = 0.5*(root+(goal/root))
print(str(root))
print("done in "+str(count)+" iterations")
Standard input is empty
5.5 3.659090909090909 3.196005081874647 3.16245562280389 3.162277665175675 3.162277660168379 done in 6 iterations