Your job is to return the volume of a cup when given the diameter of the top, the diameter of the bottom and the height.

You know that there is a steady gradient from the top to the bottom.

You want to return the volume rounded to 2 decimal places.

Exmples:
```python
cup_volume(1, 1, 1)==0.79

cup_volume(10, 8, 10)==638.79

cup_volume(1000, 1000, 1000)==785398163.4

cup_volume(13.123, 123.12, 1)==4436.57

cup_volume(5, 12, 31)==1858.51
```

You will only be passed positive numbers.

Difficulty: introductory

Starter code:

def cup_volume(d1, d2, height):
	

Solutions:
from math import pi

def cup_volume(d1, d2, h):
    return round(h / 12.0 * pi * (d1**2 + d1*d2 + d2**2), 2)

from math import pi
def cup_volume(d1, d2, height):
    r1, r2 = d1 / 2.0, d2 / 2.0
    return round(pi * height * (pow(r1, 2) + r1 * r2 + pow(r2, 2)) / 3.0, 2)

from math import pi

def cup_volume(d1, d2, h):
    return round(pi * h * (d1**2 + d1 * d2 + d2**2) / 12, 2)

def cup_volume(d1, d2, h):
        return round(h * (d1*d1 + d1*d2 + d2*d2) * 0.2617993878, 2)

cup_volume=lambda d,D,h:round(__import__('math').pi*h/12*(d*d+d*D+D*D),2)

import math

def cup_volume(d1, d2, height):
    if d1 > d2:
        d1, d2 = d2, d1
    if d1 == d2:
        return round((d1/2.0) ** 2 * math.pi * height, 2)
    x = (d1 * float(height)) / (d2 - d1)
    vol = (d2 / 2.0)**2*math.pi*(height+x) / 3.0 - (d1 / 2.0)**2*math.pi*x/3.0
    return round(vol, 2)


def cup_volume(d1, d2, height):
    v = (3.14159265359/3)*height*(((d1/2)**2) + ((d2/2)**2) + ((d1/2)*d2/2))
    return round(v,2)

import math
def cup_volume(d1, d2, height):
    return round(math.pi * height * (d1**2 + d2**2 + d1*d2)/12, 2)

from math import pi

def cup_volume(d1, d2, h):
    r1, r2 = d1 / 2, d2 / 2
    return round(pi * (1/3) * h * (r1**2 + r2**2 + r1*r2),2)