mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
🛠 some readme fixup
This commit is contained in:
@@ -2,6 +2,17 @@
|
|||||||
# NOTE: not anymore. but still leaving this comment in.
|
# NOTE: not anymore. but still leaving this comment in.
|
||||||
from mathgenerator.mathgen import *
|
from mathgenerator.mathgen import *
|
||||||
|
|
||||||
|
def array2markdown_table(string):
|
||||||
|
string = string.replace("[[", "<table><tr><td>")
|
||||||
|
string = string.replace("[", "<tr><td>")
|
||||||
|
string = string.replace(", ", "</td><td>")
|
||||||
|
string = string.replace("]]", "</td></tr></table>")
|
||||||
|
string = string.replace("]", "</td></tr>")
|
||||||
|
string = string.replace(" ", "")
|
||||||
|
string = string.replace("\n", "")
|
||||||
|
return string
|
||||||
|
|
||||||
|
|
||||||
wList = getGenList()
|
wList = getGenList()
|
||||||
lines = []
|
lines = []
|
||||||
with open('mathgenerator/mathgen.py', 'r') as f:
|
with open('mathgenerator/mathgen.py', 'r') as f:
|
||||||
@@ -17,13 +28,11 @@ for item in wList:
|
|||||||
solu = str(solu).rstrip("\n")
|
solu = str(solu).rstrip("\n")
|
||||||
# edge case for matrixMultiplication
|
# edge case for matrixMultiplication
|
||||||
if item[0] == 46:
|
if item[0] == 46:
|
||||||
prob = prob.replace("[[", "<table><tr><td>")
|
prob, solu = myGen(10, 4)
|
||||||
prob = prob.replace("[", "<tr><td>")
|
prob = str(prob).rstrip("\n")
|
||||||
prob = prob.replace(", ", "</td><td>")
|
solu = str(solu).rstrip("\n")
|
||||||
prob = prob.replace("]]\n", "</td></tr></table>")
|
prob = array2markdown_table(prob)
|
||||||
prob = prob.replace("]\n", "</td></tr>")
|
solu = array2markdown_table(solu)
|
||||||
prob = prob.replace(" ", "")
|
|
||||||
prob = prob.replace("\n", "")
|
|
||||||
|
|
||||||
instName = lines[line]
|
instName = lines[line]
|
||||||
func_name = instName[:instName.find('=')].strip() # NOTE: renamed 'def_name' to 'func_name' because it suits it more
|
func_name = instName[:instName.find('=')].strip() # NOTE: renamed 'def_name' to 'func_name' because it suits it more
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def matrixMultiplicationFunc(maxVal=100):
|
def matrixMultiplicationFunc(maxVal=100, max_dim=10):
|
||||||
m = random.randint(2, 10)
|
m = random.randint(2, max_dim)
|
||||||
n = random.randint(2, 10)
|
n = random.randint(2, max_dim)
|
||||||
k = random.randint(2, 10)
|
k = random.randint(2, max_dim)
|
||||||
|
|
||||||
# generate matrices a and b
|
# generate matrices a and b
|
||||||
a = []
|
a = []
|
||||||
|
|||||||
Reference in New Issue
Block a user