diff --git a/makeReadme.py b/makeReadme.py
index 7692e35..9a4b762 100644
--- a/makeReadme.py
+++ b/makeReadme.py
@@ -2,6 +2,17 @@
# NOTE: not anymore. but still leaving this comment in.
from mathgenerator.mathgen import *
+def array2markdown_table(string):
+ string = string.replace("[[", "
| ")
+ string = string.replace("[", " |
| ")
+ string = string.replace(", ", " | ")
+ string = string.replace("]]", " |
")
+ string = string.replace("]", "")
+ string = string.replace(" ", "")
+ string = string.replace("\n", "")
+ return string
+
+
wList = getGenList()
lines = []
with open('mathgenerator/mathgen.py', 'r') as f:
@@ -17,13 +28,11 @@ for item in wList:
solu = str(solu).rstrip("\n")
# edge case for matrixMultiplication
if item[0] == 46:
- prob = prob.replace("[[", "| ")
- prob = prob.replace("[", " |
| ")
- prob = prob.replace(", ", " | ")
- prob = prob.replace("]]\n", " |
")
- prob = prob.replace("]\n", "")
- prob = prob.replace(" ", "")
- prob = prob.replace("\n", "")
+ prob, solu = myGen(10, 4)
+ prob = str(prob).rstrip("\n")
+ solu = str(solu).rstrip("\n")
+ prob = array2markdown_table(prob)
+ solu = array2markdown_table(solu)
instName = lines[line]
func_name = instName[:instName.find('=')].strip() # NOTE: renamed 'def_name' to 'func_name' because it suits it more
diff --git a/mathgenerator/funcs/matrixMultiplicationFunc.py b/mathgenerator/funcs/matrixMultiplicationFunc.py
index eeaa265..ffddb57 100644
--- a/mathgenerator/funcs/matrixMultiplicationFunc.py
+++ b/mathgenerator/funcs/matrixMultiplicationFunc.py
@@ -1,10 +1,10 @@
from .__init__ import *
-def matrixMultiplicationFunc(maxVal=100):
- m = random.randint(2, 10)
- n = random.randint(2, 10)
- k = random.randint(2, 10)
+def matrixMultiplicationFunc(maxVal=100, max_dim=10):
+ m = random.randint(2, max_dim)
+ n = random.randint(2, max_dim)
+ k = random.randint(2, max_dim)
# generate matrices a and b
a = []