mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
* removed asterisk imports from subject inits * import Generator from the right init level
25 lines
692 B
Python
25 lines
692 B
Python
from ...__init__ import Generator
|
|
import random
|
|
|
|
|
|
def gen_func(minVal=-20, maxVal=20, format='string'):
|
|
a = [random.randint(minVal, maxVal) for i in range(3)]
|
|
b = [random.randint(minVal, maxVal) for i in range(3)]
|
|
c = [
|
|
a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2],
|
|
a[0] * b[1] - a[1] * b[0]
|
|
]
|
|
|
|
if format == 'string':
|
|
problem = str(a) + " X " + str(b) + " = "
|
|
solution = str(c)
|
|
return problem, solution
|
|
elif format == 'latex':
|
|
return "Latex unavailable"
|
|
else:
|
|
return a, b, c
|
|
|
|
|
|
vector_cross = Generator("Cross Product of 2 Vectors", 43, gen_func,
|
|
["minVal=-20", "maxVal=20"])
|