From 804ef68f6c65d711b8204f3206bae16e2afa0d88 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:02:50 -0400 Subject: [PATCH 1/6] Added Quotient of Powers with Same Base number --- .../funcs/quotientofpowersamebase.py | 21 +++++++++++++++++++ mathgenerator/mathgen.py | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 mathgenerator/funcs/quotientofpowersamebase.py 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) From 1844fb344720710c05fee848c3fcafc0ce9c0a54 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:10:32 -0400 Subject: [PATCH 2/6] 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) From 1daa09d0d152ff2f0c3d772243b6c0ce1e5c9792 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 15:34:27 -0400 Subject: [PATCH 3/6] Changed generator names to camelCase --- mathgenerator/funcs/quotientofpowersamebase.py | 2 +- mathgenerator/funcs/quotientofpowersamepower.py | 2 +- mathgenerator/mathgen.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotientofpowersamebase.py index 8fbceba..0e0fdf6 100644 --- a/mathgenerator/funcs/quotientofpowersamebase.py +++ b/mathgenerator/funcs/quotientofpowersamebase.py @@ -17,5 +17,5 @@ def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): return problem, solution -quotientofpowersamebase = Generator("Quotient of Powers with Same Base", 82, +quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotientofpowersamepower.py index 25fd8cd..b7dd980 100644 --- a/mathgenerator/funcs/quotientofpowersamepower.py +++ b/mathgenerator/funcs/quotientofpowersamepower.py @@ -17,5 +17,5 @@ def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): return problem, solution -quotientofpowersamepower = Generator("Quotient of Powers with Same Power", 83, +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 849e4f2..3fb482c 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -267,8 +267,8 @@ decimalToHexadeci = Generator("Decimal to Hexadecimal", 79, "Binary of a=", "b", deciToHexaFunc) 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, +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, +quotientOfPowerSamePower = Generator("Quotient of Powers with Same Power", 83, "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) From 86750f5867ba4c1a9fa9aeb62edc05ecc4604328 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 10:44:18 -0400 Subject: [PATCH 4/6] Fixed lint issues --- mathgenerator/funcs/quotientofpowersamebase.py | 2 +- mathgenerator/funcs/quotientofpowersamepower.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotientofpowersamebase.py index 0e0fdf6..546b205 100644 --- a/mathgenerator/funcs/quotientofpowersamebase.py +++ b/mathgenerator/funcs/quotientofpowersamebase.py @@ -18,4 +18,4 @@ def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotientofpowersamepower.py index b7dd980..2fabaa0 100644 --- a/mathgenerator/funcs/quotientofpowersamepower.py +++ b/mathgenerator/funcs/quotientofpowersamepower.py @@ -6,16 +6,16 @@ def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): base1 = random.randint(1, maxBase) base2 = random.randint(1, maxBase) power = random.randint(1, maxPower) - step = base1/base2 + 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) + 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) + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) From 0c10fb8bc35fcf5b65cdd52a78a605babe75b39b Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 11:43:22 -0400 Subject: [PATCH 5/6] Changed file names to match the project standards --- ...entofpowersamebase.py => quotient_of_power_same_base.py} | 6 +++--- ...tofpowersamepower.py => quotient_of_power_same_power.py} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename mathgenerator/funcs/{quotientofpowersamebase.py => quotient_of_power_same_base.py} (80%) rename mathgenerator/funcs/{quotientofpowersamepower.py => quotient_of_power_same_power.py} (72%) diff --git a/mathgenerator/funcs/quotientofpowersamebase.py b/mathgenerator/funcs/quotient_of_power_same_base.py similarity index 80% rename from mathgenerator/funcs/quotientofpowersamebase.py rename to mathgenerator/funcs/quotient_of_power_same_base.py index 546b205..01c6dd0 100644 --- a/mathgenerator/funcs/quotientofpowersamebase.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -2,7 +2,7 @@ from .__init__ import * from ..__init__ import Generator -def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): +def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): base = random.randint(1, maxBase) power1 = random.randint(1, maxPower) power2 = random.randint(1, maxPower) @@ -17,5 +17,5 @@ def quotientofpowersamebaseFunc(maxBase=50, maxPower=10): return problem, solution -quotientOfPowerSameBase = Generator("Quotient of Powers with Same Base", 82, - "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientofpowersamebaseFunc) +quotient_of_power_same_base = Generator("Quotient of Powers with Same Base", 82, + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc()) diff --git a/mathgenerator/funcs/quotientofpowersamepower.py b/mathgenerator/funcs/quotient_of_power_same_power.py similarity index 72% rename from mathgenerator/funcs/quotientofpowersamepower.py rename to mathgenerator/funcs/quotient_of_power_same_power.py index 2fabaa0..d1383da 100644 --- a/mathgenerator/funcs/quotientofpowersamepower.py +++ b/mathgenerator/funcs/quotient_of_power_same_power.py @@ -2,7 +2,7 @@ from .__init__ import * from ..__init__ import Generator -def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): +def quotientOfPowerSamePowerFunc(maxBase=50, maxPower=10): base1 = random.randint(1, maxBase) base2 = random.randint(1, maxBase) power = random.randint(1, maxPower) @@ -17,5 +17,5 @@ def quotientofpowersamepowerFunc(maxBase=50, maxPower=10): return problem, solution -quotientOfPowerSamePower = Generator("Quotient of Powers with Same Power", 83, - "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientofpowersamepowerFunc) +quotient_of_power_same_power = Generator("Quotient of Powers with Same Power", 83, + "6^4 / 3^4 = (6/3)^4 = 2^4", "16", quotientOfPowerSamePowerFunc()) From 94d677656b5ca6510820ae8317c25478758727a6 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Wed, 21 Oct 2020 11:53:33 -0400 Subject: [PATCH 6/6] Lint issue... --- mathgenerator/funcs/quotient_of_power_same_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/quotient_of_power_same_base.py b/mathgenerator/funcs/quotient_of_power_same_base.py index 01c6dd0..4b74a7f 100644 --- a/mathgenerator/funcs/quotient_of_power_same_base.py +++ b/mathgenerator/funcs/quotient_of_power_same_base.py @@ -13,9 +13,9 @@ def quotientOfPowerSameBaseFunc(maxBase=50, maxPower=10): power1=power1, power2=power2, step=step) - solution = str(base**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()) + "6^4 / 6^2 = 6^(4-2) = 6^2", "36", quotientOfPowerSameBaseFunc())