fork download
  1. #
  2. import math
  3. s = 13.
  4. x = 13.
  5.  
  6. def f(x):
  7. return((x+ s/x)/2.)
  8.  
  9.  
  10. for i in range(10):
  11. x=f(x)
  12.  
  13. print(x)
  14.  
  15. print(math.sqrt(s))
  16.  
  17.  
Success #stdin #stdout 0.12s 14112KB
stdin
Standard input is empty
stdout
3.6055512754639896
3.605551275463989