From 1844fb344720710c05fee848c3fcafc0ce9c0a54 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:10:32 -0400 Subject: [PATCH] Added Quotient of Powers with Same Power number --- .../funcs/quotientofpowersamepower.py | 21 +++++++++++++++++++ mathgenerator/mathgen.py | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 mathgenerator/funcs/quotientofpowersamepower.py diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotientofpowersamepower.py new file mode 100644 index 0000000..25fd8cd --- /dev/null +++ b/mathgenerator/funcs/quotientofpowersamepower.py @@ -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 + + +quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index f53bb51..849e4f2 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -270,3 +270,5 @@ percentage = Generator("Percentage of a number", 80, "What is a% of b?", 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) +quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc)