Learning Scientific Programming with Python (2nd edition)
P2.7.4: Volume and surface area of a right regular pyramid
Question P2.7.4
A right regular pyramid with height $h$ and a base consisting of a regular $n$-sided polygon of side length $s$ has a volume, $V = \frac{1}{3}Ah$ and total surface area, $S = A + \frac{1}{2}nsl$ where $A$ is the base area and $l$ the slant height which may be calculated from the apothem of the base polygon, $a = \frac{1}{2}s\cot\frac{\pi}{n}$ as $A = \frac{1}{2}nsa$ and $l = \sqrt{h^2 + a^2}$.
Use these formulae to define a function, pyramid_AV
returning $V$ and $S$ when passed values for $n$, $s$ and $h$.