mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Merge pull request #269 from helplessThor/helplessThor-degree-rad
Angle Conversion Between Degree and Radians
This commit is contained in:
@@ -88,3 +88,5 @@ from .arithmeticProgressionTermFunc import *
|
|||||||
from .arithmeticProgressionSumFunc import *
|
from .arithmeticProgressionSumFunc import *
|
||||||
from .decimalToOctalFunc import *
|
from .decimalToOctalFunc import *
|
||||||
from .decimalToRomanNumeralsFunc import *
|
from .decimalToRomanNumeralsFunc import *
|
||||||
|
from .degreeToRadFunc import *
|
||||||
|
from .radianToDegFunc import *
|
||||||
|
|||||||
16
mathgenerator/funcs/degreeToRadFunc.py
Normal file
16
mathgenerator/funcs/degreeToRadFunc.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
from numpy import pi
|
||||||
|
|
||||||
|
|
||||||
|
def degreeToRadFunc(max_deg=360):
|
||||||
|
a = random.randint(0, max_deg)
|
||||||
|
b = (pi * a) / 180
|
||||||
|
b = round(b, 2)
|
||||||
|
|
||||||
|
problem = "Angle " + str(a) + " in radians is = "
|
||||||
|
solution = str(b)
|
||||||
|
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
|
degreeToRad = Generator("Degrees to Radians", 86, "Angle a in radians is = ", "b", degreeToRadFunc)
|
||||||
16
mathgenerator/funcs/radianToDegFunc.py
Normal file
16
mathgenerator/funcs/radianToDegFunc.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
from numpy import pi
|
||||||
|
|
||||||
|
|
||||||
|
def degreeToRadFunc(max_rad=pi):
|
||||||
|
a = random.randint(0, max_rad)
|
||||||
|
b = (180 * a) / pi
|
||||||
|
b = round(b, 2)
|
||||||
|
|
||||||
|
problem = "Angle " + str(a) + " in degrees is = "
|
||||||
|
solution = str(b)
|
||||||
|
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
|
radianToDeg = Generator("Radians to Degrees", 87, "Angle a in degrees is = ", "b", radianToDegFunc)
|
||||||
Reference in New Issue
Block a user