Problem in multiply_basic function

My multiply_basic function is not working properly. It append the number but i need to add the number whose exponential sums are equal needs to be added please me out with or suggest me some other algorithm.
Help me out with this pls

def multiply_basic(poly1, poly2):
    result = [None]*((len(poly1)+len(poly2))-1)
    for k in range (len(result)):
        for i in range(len(poly1)):
            for j in range(0,len(poly2)):
                if k==(i+j):

You need to update the result list when the condition (i+j==k) is true.

here, you are just returning the latest value for it.

Try, result[ i + j ] += (poly1[i]*poly2[j])
and return it.

Also you would have to initialize the result list as result = [0]*((len(poly1)+len(poly2))-1)
instead of