*** Nova polynomial multiply*** 

This kata is from a series on polynomial handling. ( [#1](http://www.codewars.com/kata/nova-polynomial-1-add-1)   [#2](http://www.codewars.com/kata/570eb07e127ad107270005fe)  [#3](http://www.codewars.com/kata/5714041e8807940ff3001140 )   [#4](http://www.codewars.com/kata/571a2e2df24bdfd4e20001f5))

Consider a polynomial in a list where each element in the list element corresponds to the factors. The factor order is the position in the list. The first element is the zero order factor (the constant).

p = [a0, a1, a2, a3] signifies the polynomial a0 + a1x + a2x^2 + a3*x^3

In this kata multiply two polynomials:

```python 
poly_multiply([1, 2], [1] ) = [1, 2]
poly_multiply([2, 4], [4, 5] ) = [8, 26, 20]
```
The first kata of this series is preloaded in the code and can be used: [poly_add](http://www.codewars.com/kata/nova-polynomial-1-add-1)

Difficulty: introductory

Starter code:

def poly_multiply(p1, p2):
	

Solutions:
def poly_multiply(p1, p2):
  if not p1 or not p2: return []
  n = len(p1) + len(p2) - 1
  p = [0]*n
  for i,a in enumerate(p1):
    for j,b in enumerate(p2):
      p[i + j] += a*b
  return p

from numpy import polymul

def poly_multiply(p1, p2):
    res = list(polymul(p1, p2))
    return res if any(res) else []

def poly_multiply(p1,p2):
    r,s={},[] 
    for i in range(len(p1)):
       for j in range(len(p2)): r[i+j]= r[i+j]+p1[i]*p2[j] if i+j in r else p1[i]*p2[j]
    for i in r: s.append(r[i]) 
    return s     

from numpy import polymul

def poly_multiply(p1, p2):
    if not (p1 and p2 and any(p1) and any(p2)): return []
    return polymul(p1, p2).tolist()

from itertools import zip_longest
poly_multiply=lambda a,b:[sum(i) for i in zip_longest(*[[0]*i+[j*k for k in a] for i,j in enumerate(b)],fillvalue=0)] if a else []

def poly_multiply(p1, p2):
    result = [0 for _ in range(len(p1)+len(p2)-1)]
    for i, n1 in enumerate(p1):
        for j, n2 in enumerate(p2):
            result[i+j] += n1 * n2
    return [] if not p1 or not p2 else result

import numpy as np

def poly_multiply(p1, p2):
    return np.trim_zeros(np.polymul(p1, p2), 'f').tolist()

def poly_multiply(a, b):
    if a== [] or b== []:
        return []
    r=[0 for i in range(len(a)+len(b)-1)]
    for k,j in enumerate(a):
        for m,n in enumerate(b):
            r[k+m] += j*n    
    return r

def poly_multiply(p1, p2):
    ans = [0] * (len(p1) + len(p2) - 1)
    for i in range(len(p1)):
        for j in range(len(p2)):
            ans[i + j] += p1[i] * p2[j]
    return any(ans) and ans or []