def f(x): return x**3-2*x-9 def dichotomie(f, p): a = 1 b = 5 while ...: m = ... if ... : b = m else: a = m return [a, b]