mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
function name included in generator instance variables and genList[3]
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import sys
|
||||
import traceback
|
||||
genList = []
|
||||
|
||||
|
||||
@@ -8,7 +10,12 @@ class Generator:
|
||||
self.generalProb = generalProb
|
||||
self.generalSol = generalSol
|
||||
self.func = func
|
||||
genList.append([id, title, self])
|
||||
|
||||
(filename, line_number, function_name, text) = traceback.extract_stack()[-2]
|
||||
funcname = filename[filename.rfind('/'):].strip()
|
||||
funcname = funcname[1:-3]
|
||||
print(funcname)
|
||||
genList.append([id, title, self, funcname])
|
||||
|
||||
def __str__(self):
|
||||
return str(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .__init__ import *
|
||||
from ..__init__ import Generator
|
||||
import math
|
||||
|
||||
|
||||
def angleBtwVectorsFunc(maxEltAmt=20):
|
||||
@@ -15,7 +16,7 @@ def angleBtwVectorsFunc(maxEltAmt=20):
|
||||
solution = ''
|
||||
try:
|
||||
solution = str(math.acos(s / mags))
|
||||
except MathDomainError:
|
||||
except ValueError:
|
||||
print('angleBtwVectorsFunc has some issues with math module, line 16')
|
||||
solution = 'NaN'
|
||||
# would return the answer in radians
|
||||
|
||||
@@ -4,7 +4,10 @@ from ..__init__ import Generator
|
||||
|
||||
def multiplicationFunc(maxRes=99, maxMulti=99):
|
||||
a = random.randint(0, maxMulti)
|
||||
b = random.randint(0, min(int(maxMulti / a), maxRes))
|
||||
if a == 0:
|
||||
b = random.randint(0, maxRes)
|
||||
else:
|
||||
b = random.randint(0, min(int(maxMulti / a), maxRes))
|
||||
c = a * b
|
||||
|
||||
problem = str(a) + "*" + str(b) + "="
|
||||
|
||||
@@ -2,7 +2,8 @@ from .__init__ import *
|
||||
from numpy import pi
|
||||
|
||||
|
||||
def radianToDegFunc(max_rad=pi):
|
||||
def radianToDegFunc(max_rad=3):
|
||||
# max_rad is supposed to be pi but random can't handle non-integer
|
||||
a = random.randint(0, max_rad)
|
||||
b = (180 * a) / pi
|
||||
b = round(b, 2)
|
||||
|
||||
Reference in New Issue
Block a user