From c6e3d8a8fdccad2283e3d3f2c1bf505f45884955 Mon Sep 17 00:00:00 2001 From: Priyadarshan Mohanty Date: Sun, 18 Oct 2020 00:19:23 +0530 Subject: [PATCH] Surface Area of Sphere added --- mathgenerator/mathgen.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index 02b4c1d..e3f8995 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -476,6 +476,14 @@ def surfaceAreaCuboid(maxSide = 20, unit = 'm'): solution = f"{ans} {unit}^2" return problem, solution +def surfaceAreaSphere(maxSide = 20, unit = 'm'): + r = random.randint(1, maxSide) + + problem = f"Surface area of Sphere with radius = {r}{unit} is" + ans = 4 * math.pi * r * r + solution = f"{ans} {unit}^2" + return problem, solution + def volumeCuboid(maxSide = 20, unit = 'm'): a = random.randint(1, maxSide) b = random.randint(1, maxSide) @@ -896,3 +904,4 @@ surdsComparison = Generator("Comparing surds", 55, "Fill in the blanks a^(1/b) _ fibonacciSeries = Generator("Fibonacci Series",56,"fibonacci series of first a numbers","prints the fibonacci series starting from 0 to a",fibonacciSeriesFunc) basicTrigonometry=Generator("Trigonometric Values",57,"What is sin(X)?","ans",basicTrigonometryFunc) sumOfAnglesOfPolygon = Generator("Sum of Angles of Polygon", 58, "Sum of angles of polygon with n sides = ", "sum", sumOfAnglesOfPolygonFunc) +surfaceAreaSphereGen = Generator("Surface Area of Sphere", 59, "Surface area of sphere with radius = a units is","d units^2", surfaceAreaSphere) \ No newline at end of file