# Derivative of a Polynomial

Given a polynomial expression (you can assume any representation for your convenience), return the derivative of the polynomial expression.

```python
import collections


Poly = collections.namedtuple('Poly', 'ceof exp')

def derivative(poly):
    """
    :param poly: List[namedtuple] - polynomial expression
    :return: List[namedtuple] - derived polynomial expression
    """
    return [Poly(ceof=ceof*exp, exp=exp-1) for ceof, exp in poly if exp != 0]


t1 = [Poly(ceof=2, exp=3)]
print(derivative(t1))

t2 = [Poly(ceof=10, exp=1)]
print(derivative(t2))

t3 = [Poly(ceof=100, exp=0), Poly(ceof=2, exp=200)]
print(derivative(t3))

t4 = [Poly(ceof=100, exp=-3), Poly(ceof=2, exp=-30)]
print(derivative(t4))
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://maksimdan.gitbook.io/interview-practice-problems/leetcode_sessions/mathematics/derivative-of-a-polynomial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
