From ce5b3168bdcb39ef614cb73bdaf94824122d6bdb Mon Sep 17 00:00:00 2001 From: BiscuitCandy <70342294+BiscuitCandy@users.noreply.github.com> Date: Fri, 8 Oct 2021 19:38:50 -0700 Subject: [PATCH] added volume Hemisphere --- .../funcs/geometry/volume_hemisphere.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 mathgenerator/funcs/geometry/volume_hemisphere.py diff --git a/mathgenerator/funcs/geometry/volume_hemisphere.py b/mathgenerator/funcs/geometry/volume_hemisphere.py new file mode 100644 index 0000000..95b612a --- /dev/null +++ b/mathgenerator/funcs/geometry/volume_hemisphere.py @@ -0,0 +1,19 @@ +from .__init__ import * + + +def gen_func(maxRadius=100, format='string'): + r = random.randint(1, maxRadius) + ans = round((2 * math.pi / 3) * r**3, 3) + + if format == 'string': + problem = f"Volume of hemisphere with radius {r} m = " + solution = f"{ans} m^3" + return problem, solution + elif format == 'latex': + return "Latex unavailable" + else: + return r, ans + + +volume_sphere = Generator("Volume of Hemisphere", 61, gen_func, + ["maxRadius=100"]) \ No newline at end of file