Calculates the surface area of a regular dodecahedron a = 3 * ((25 + 10 * (5** (1 / 2))) ** (1 / 2 )) * (e**2) where: a --> is the area of the dodecahedron e --> is the length of the edge reference-->"Dodecahedron" Study.com <https://study.com/academy/lesson/dodecahedron
(edge: float)
| 7 | |
| 8 | |
| 9 | def dodecahedron_surface_area(edge: float) -> float: |
| 10 | """ |
| 11 | Calculates the surface area of a regular dodecahedron |
| 12 | a = 3 * ((25 + 10 * (5** (1 / 2))) ** (1 / 2 )) * (e**2) |
| 13 | where: |
| 14 | a --> is the area of the dodecahedron |
| 15 | e --> is the length of the edge |
| 16 | reference-->"Dodecahedron" Study.com |
| 17 | <https://study.com/academy/lesson/dodecahedron-volume-surface-area-formulas.html> |
| 18 | |
| 19 | :param edge: length of the edge of the dodecahedron |
| 20 | :type edge: float |
| 21 | :return: the surface area of the dodecahedron as a float |
| 22 | |
| 23 | |
| 24 | Tests: |
| 25 | >>> dodecahedron_surface_area(5) |
| 26 | 516.1432201766901 |
| 27 | >>> dodecahedron_surface_area(10) |
| 28 | 2064.5728807067603 |
| 29 | >>> dodecahedron_surface_area(-1) |
| 30 | Traceback (most recent call last): |
| 31 | ... |
| 32 | ValueError: Length must be a positive. |
| 33 | """ |
| 34 | |
| 35 | if edge <= 0 or not isinstance(edge, int): |
| 36 | raise ValueError("Length must be a positive.") |
| 37 | return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) |
| 38 | |
| 39 | |
| 40 | def dodecahedron_volume(edge: float) -> float: |
nothing calls this directly
no outgoing calls
no test coverage detected