mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
Update mathgen.py
This commit is contained in:
@@ -63,6 +63,14 @@ def binaryComplement1sFunc(maxDigits = 10):
|
||||
solution = answer
|
||||
return problem, solution
|
||||
|
||||
def moduloFunc(maxRes = 99, maxModulo= 99):
|
||||
a = random.randint(0, maxModulo)
|
||||
b = random.randint(0, min(maxRes, maxModulo))
|
||||
c = a%b
|
||||
problem = str(a) + "%" + str(b) + "="
|
||||
solution = str(c)
|
||||
return problem, solution
|
||||
|
||||
# || Class Instances
|
||||
|
||||
#Format is:
|
||||
@@ -72,4 +80,5 @@ subtraction = Generator("Subtraction", 3, "a-b=", "c", subtractionFunc)
|
||||
multiplication = Generator("Multiplication", 4, "a*b=", "c", multiplicationFunc)
|
||||
division = Generator("Division", 5, "a/b=", "c", divisionFunc)
|
||||
binaryComplement1s = Generator("binary_complement_1s", 6, "(1010)=", "0101", binaryComplement1sFunc)
|
||||
modulo division = Generator("Modulo Division", 6, "a%b=", "c", moduloFunc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user