import numpy as np
from scipy.optimize import root
def func(x):
return x * 2 + 2 * np.cos(x)
sol = root(func, 0.3)
print(sol)