Naive Approach

# Time complexity: O(n^2)
def evaluate(poly, x):
    result = 0
    for i in range(len(poly)):
        result += poly[i] * (x ** i)
    return result

Horner’s Method

# Time complexity: O(n)
def evaluate(poly, x): 
    result = poly[len(poly) - 1]
    # Loop 
    for i in range(len(poly) - 2, -1, -1): 
        result = result * x + poly[i]
    return result