Calculus class...is awesome! But you are a programmer with no time for mindless repetition. Your teacher spent a whole day covering differentiation of polynomials, and by the time the bell rang, you had already conjured up a program to automate the process.

You realize that a polynomial of degree n

anx^(n) + an-1x^(n-1) + ... + a0

can be represented as an array of coefficients

[an, an-1, ...,  a0]

For example, we would represent

5x^(2) + 2x + 1 as [5,2,1]

3x^(2) + 1 as [3,0,1]

x^(4) as [1,0,0,0,0]

x as [1, 0]

1 as [1]

Your function will take a coefficient array as an argument and return a **new array** representing the coefficients of the derivative.

```python
poly1 = [1, 1] # x + 1
diff(poly1) == [1] # 1

poly2 = [1, 1, 1] # x^2 + x + 1
diff(poly2) == [2, 1] # 2x + 1
diff(diff(poly2)) == [2] # 2

poly3 = [2, 1, 0, 0] # 2x^3 + x^2
diff(poly3) == [6, 2, 0] # 6x^2 + 2x
```
Note: your function will always return a new array which has one less element than the argument (unless the argument is [], in which case [] is returned).

Difficulty: introductory

Starter code:

def diff(poly):
	

Solutions:
def diff(poly):
  return [poly[i] * (len(poly)-1-i) for i in range(len(poly)-1)]

def diff(poly):
    return [d*c for d,c in enumerate(poly[::-1]) if d][::-1]

diff=lambda s:[i*j for i,j in enumerate(s[:-1][::-1],1)][::-1]

def diff(poly):
    return [i * n for i, n in enumerate(poly[-2::-1], 1)][::-1]

def diff(poly):
    return [-i * n for i, n in enumerate(poly[:-1], -len(poly)+1)]

def diff(poly):
    return [i * x for i, x in enumerate(poly[::-1][1:], 1)][::-1]


def diff(poly):
    return [poly[i]*(len(poly)-i-1) for i in range(len(poly)-1)]

diff=lambda p:[i*f for i,f in enumerate(p[::-1])][:0:-1]

def diff(poly):
    n = len(poly) - 1
    return [ a * (n - i) for i, a in enumerate(poly[:-1]) ]

def diff(poly):
    n = len(poly) - 1
    poly = poly[:-1]
    return [x * (n - i) for i, x in enumerate(poly)]