Evaluate value of polynomial in python code