mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
complete restructure of the project. minor tweaks
This commit is contained in:
24
mathgenerator/funcs/commonFactorsFunc.py
Normal file
24
mathgenerator/funcs/commonFactorsFunc.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from .__init__ import *
|
||||
|
||||
|
||||
def commonFactorsFunc(maxVal=100):
|
||||
a = x = random.randint(1, maxVal)
|
||||
b = y = random.randint(1, maxVal)
|
||||
|
||||
if (x < y):
|
||||
min = x
|
||||
else:
|
||||
min = y
|
||||
|
||||
count = 0
|
||||
arr = []
|
||||
|
||||
for i in range(1, min + 1):
|
||||
if (x % i == 0):
|
||||
if (y % i == 0):
|
||||
count = count + 1
|
||||
arr.append(i)
|
||||
|
||||
problem = f"Common Factors of {a} and {b} = "
|
||||
solution = arr
|
||||
return problem, solution
|
||||
Reference in New Issue
Block a user