mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Merge pull request #306 from Nitsujed/QuotientofPowers
Quotient of powers for same base and same power
This commit is contained in:
21
mathgenerator/funcs/quotient_of_power_same_base.py
Normal file
21
mathgenerator/funcs/quotient_of_power_same_base.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
from ..__init__ import Generator
|
||||||
|
|
||||||
|
|
||||||
|
def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10):
|
||||||
|
base = random.randint(1, maxBase)
|
||||||
|
power1 = random.randint(1, maxPower)
|
||||||
|
power2 = random.randint(1, maxPower)
|
||||||
|
step = power1 - power2
|
||||||
|
|
||||||
|
problem = "The Quotient of {base}^{power1} and {base}^{power2} = " \
|
||||||
|
"{base}^({power1}-{power2}) = {base}^{step}".format(base=base,
|
||||||
|
power1=power1,
|
||||||
|
power2=power2,
|
||||||
|
step=step)
|
||||||
|
solution = str(base ** step)
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
|
quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 82,
|
||||||
|
"6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc())
|
||||||
21
mathgenerator/funcs/quotient_of_power_same_power.py
Normal file
21
mathgenerator/funcs/quotient_of_power_same_power.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
from .__init__ import *
|
||||||
|
from ..__init__ import Generator
|
||||||
|
|
||||||
|
|
||||||
|
def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10):
|
||||||
|
base1 = random.randint(1, maxBase)
|
||||||
|
base2 = random.randint(1, maxBase)
|
||||||
|
power = random.randint(1, maxPower)
|
||||||
|
step = base1 / base2
|
||||||
|
|
||||||
|
problem = "The Quotient of {base1}^{power} and {base2}^{power} = " \
|
||||||
|
"({base1}/{base2})^{power} = {step}^{power}".format(base1=base1,
|
||||||
|
base2=base2,
|
||||||
|
power=power,
|
||||||
|
step=step)
|
||||||
|
solution = str(step ** power)
|
||||||
|
return problem, solution
|
||||||
|
|
||||||
|
|
||||||
|
quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 83,
|
||||||
|
"6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc())
|
||||||
Reference in New Issue
Block a user