fork download
  1. # 0J/QsNGA0YXQvtC80LXQvdC60L4=
  2. tol = 1.232E-8
  3. s=13
  4. x=13
  5.  
  6. def f(x):
  7. return (x+s/x)/2
  8.  
  9.  
  10. while True:
  11. tmp = f(x)
  12. if abs(tmp - x) < tol:
  13. break
  14. x = tmp
  15.  
  16. print(x)
Success #stdin #stdout 0.07s 14204KB
stdin
Standard input is empty
stdout
3.6055512754639905