from math import sin def derivee_f(x): return -sin(x)-1 def newton(x0,e): x = x0 while abs(f(x))>e: d=derivee_f(x) x = x-f(x)/d return x