mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
added volume Hemisphere
This commit is contained in:
19
mathgenerator/funcs/geometry/volume_hemisphere.py
Normal file
19
mathgenerator/funcs/geometry/volume_hemisphere.py
Normal file
@@ -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"])
|
||||
Reference in New Issue
Block a user