diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotientofpowersamebase.py new file mode 100644 index 0000000..8fbceba --- /dev/null +++ b/mathgenerator/funcs/quotientofpowersamebase.py @@ -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 + + +quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index f679b0c..f53bb51 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -268,3 +268,5 @@ decimalToHexadeci = Generator("Decimal to Hexadecimal", 79, "Binary of a=", percentage = Generator("Percentage of a number", 80, "What is a% of b?", "percentage", percentageFunc) celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc) +quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc)