mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
19 lines
453 B
Python
19 lines
453 B
Python
from .__init__ import *
|
|
|
|
|
|
def multiplicationFunc(maxRes=99, maxMulti=99):
|
|
a = random.randint(0, maxMulti)
|
|
if a == 0:
|
|
b = random.randint(0, maxRes)
|
|
else:
|
|
b = random.randint(0, min(int(maxMulti / a), maxRes))
|
|
c = a * b
|
|
|
|
problem = str(a) + "*" + str(b) + "="
|
|
solution = str(c)
|
|
return problem, solution
|
|
|
|
|
|
multiplication = Generator("Multiplication", 2, "a*b=", "c",
|
|
multiplicationFunc)
|