mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Fix genById missing args/kwargs
This commit is contained in:
@@ -2,6 +2,9 @@ from .__init__ import *
|
|||||||
|
|
||||||
|
|
||||||
def additionFunc(maxSum=99, maxAddend=50):
|
def additionFunc(maxSum=99, maxAddend=50):
|
||||||
|
print(maxSum)
|
||||||
|
if maxAddend > maxSum:
|
||||||
|
maxAddend = maxSum
|
||||||
a = random.randint(0, maxAddend)
|
a = random.randint(0, maxAddend)
|
||||||
# The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well
|
# The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well
|
||||||
b = random.randint(0, min((maxSum - a), maxAddend))
|
b = random.randint(0, min((maxSum - a), maxAddend))
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ genList = getGenList()
|
|||||||
|
|
||||||
|
|
||||||
# || Non-generator Functions
|
# || Non-generator Functions
|
||||||
def genById(id):
|
def genById(id, *args, **kwargs):
|
||||||
generator = genList[id][2]
|
generator = genList[id][2]
|
||||||
return (generator())
|
return (generator(*args, **kwargs))
|
||||||
|
|
||||||
|
|
||||||
def make_worksheet(title):
|
def make_worksheet(title):
|
||||||
|
|||||||
10
test.py
10
test.py
@@ -5,12 +5,14 @@ from mathgenerator import mathgen
|
|||||||
# print(mathgen.addition())
|
# print(mathgen.addition())
|
||||||
|
|
||||||
# prints each generator in genList
|
# prints each generator in genList
|
||||||
list = mathgen.getGenList()
|
# list = mathgen.getGenList()
|
||||||
for item in list:
|
#for item in list:
|
||||||
print(item[2])
|
# print(item[2])
|
||||||
|
|
||||||
# print(mathgen.getGenList())
|
# print(mathgen.getGenList())
|
||||||
print(mathgen.genById(10))
|
#print(mathgen.genById(10))
|
||||||
|
|
||||||
#Make a pdf with 10 problems of generator id 1
|
#Make a pdf with 10 problems of generator id 1
|
||||||
# mathgen.makePdf(0, 10)
|
# mathgen.makePdf(0, 10)
|
||||||
|
|
||||||
|
print(mathgen.genById(0, maxSum=20))
|
||||||
|
|||||||
Reference in New Issue
Block a user