Added latex for 11, 12, and 17. First 3 of algebra section

This commit is contained in:
lukew3
2020-12-17 18:58:01 -05:00
parent 3fb3a07c65
commit c0d2a2755c
4 changed files with 41 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
from .__init__ import *
def basicAlgebraFunc(maxVariable=10):
def basicAlgebraFunc(maxVariable=10, style='raw'):
a = random.randint(1, maxVariable)
b = random.randint(1, maxVariable)
c = random.randint(b, maxVariable)
@@ -20,8 +20,12 @@ def basicAlgebraFunc(maxVariable=10):
elif a == 1 or a == i:
x = f"{c - b}"
problem = f"{a}x + {b} = {c}"
solution = x
if style == 'latex':
problem = f"\\({a}x + {b} = {c}\\)"
solution = "\\(" + x + "\\)"
else:
problem = f"{a}x + {b} = {c}"
solution = x
return problem, solution