Fixed useless parameters on Multiplication

This commit is contained in:
mushahidq
2020-10-15 00:53:51 +05:30
parent 8e1277a56a
commit 4f18c547f7

View File

@@ -36,9 +36,16 @@ def subtractionFunc(maxMinuend = 99, maxDiff = 99):
return problem, solution
def multiplicationFunc(maxRes = 99, maxMulti = 99):
a = random.randint(0, maxMulti)
b = random.randint(0, min(maxRes, maxMulti))
c = a*b
c = random.randint(0, maxMulti) # Generate the solution to the problem
i = int(1)
j = 0 #Indices for the loop
d = [] #Array to store the factors
while(i<=c): #Factors are less than or eqaul to the number
if(c%i == 0): #If the remainder is 0, the number is a factor
d[j] = i #Store the factor
j += 1 #Move to the next index
a = random.randint(0, c) #Generate a multiplicant
b = c/a #Find the other multiplicant
problem = str(a) + "*" + str(b) + "="
solution = str(c)
return problem, solution