I want to use the f (x) function in python. Something like ax ^ 2 + bx + c (polynomials). I want to do this with a for loop and a list. This is what I have so far:
def f(a,x): for i in range (0, len(a)): i = ([a]*x**i) print (i)
for example: when I fill in f([5,2,3],5) , I need to get: 3 * 5 ^ 0 + 2 * 5 ^ 1 + 5 * 5 ^ 2. Does anyone know how I can change my code so that the result is the result of this polynomial?
source share