add format kwarg

This commit is contained in:
lukew3
2021-10-06 02:22:32 -04:00
parent 6b35cbb452
commit 9682a569ba
115 changed files with 934 additions and 628 deletions

View File

@@ -1,17 +1,20 @@
from .__init__ import *
def squareFunc(maxSquareNum=20, style='raw'):
def squareFunc(maxSquareNum=20, format='string'):
a = random.randint(1, maxSquareNum)
b = a * a
if style == 'latex':
problem = "\\(" + str(a) + "^{2}=\\)"
solution = "\\(" + str(b) + "\\)"
else:
if format == 'string':
problem = str(a) + "^2" + "="
solution = str(b)
return problem, solution
return problem, solution
if format == 'latex':
problem = "\\(" + str(a) + "^{2}=\\)"
solution = "\\(" + str(b) + "\\)"
return problem, solution
else:
return a, b
square = Generator("Square", 8, squareFunc, ["maxSquareNum=20"])