def sum_f(f, xs):
    """ Returns the sum of the function values of f evaluated at values x0, x1, x2, ..., xn
     where xs=[x0,x1,x2,...,xn]."""

    ans = 0
    for x in xs:
        ans += f(x)
    return ans