can’t multiply sequence by non-int of type ‘list’

def evalPolynomial(coeffs,x):
        return sum([n for n in coeffs] * [x**(m-1)for m in range(len(coeffs),0,-1)]) 

TypeError: can’t multiply sequence by non-int of type ‘list’

Not sure what’s causing the error? When I print each of the statements separately, they each give me a list, but when I try to multiply them it doesn’t work.

Leave a Comment