from math import exp
def f(x):
return x * exp(x)
def dicho(a, b, eps):
while b - a > eps:
m = (a + b) / 2
if f(m) > 1:
b = m
else:
a = m
return a, b
a, b = dicho(0, 1, 1e-7)
print(a, b)
To embed this program on your website, copy the following code and paste it into your website's HTML: