From 40f2ce1af3d3c7e9489a10cd355b668e9a8bbc05 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 14:04:35 -0400 Subject: [PATCH 1/3] Added Celsius to Fahrenheit Conversion formula --- mathgenerator/funcs/celsiustofahrenheit.py | 11 +++++++++++ mathgenerator/mathgen.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 mathgenerator/funcs/celsiustofahrenheit.py diff --git a/mathgenerator/funcs/celsiustofahrenheit.py b/mathgenerator/funcs/celsiustofahrenheit.py new file mode 100644 index 0000000..ec981db --- /dev/null +++ b/mathgenerator/funcs/celsiustofahrenheit.py @@ -0,0 +1,11 @@ +from .__init__ import * +from ..__init__ import Generator + +def celsiustofahrenheit(maxTemp=100): + celsius = random.randint(-50, maxTemp) + fahrenheit = (celsius * (9/5)) +32 + problem = "Convert", str(celsius), "deg Celsius to degrees Fahrenheit =" + solution = str(fahrenheit) + return problem, solution + +celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheit) diff --git a/mathgenerator/mathgen.py b/mathgenerator/mathgen.py index ae84143..00bde03 100644 --- a/mathgenerator/mathgen.py +++ b/mathgenerator/mathgen.py @@ -116,3 +116,4 @@ intMatrix22determinant = Generator("Determinant to 2x2 Matrix", 77, "Det([[a,b], compoundInterest = Generator("Compound Interest", 78, "Compound interest for a principle amount of p dollars, r% rate of interest and for a time period of t years with n times compounded annually is = ", "A dollars", compoundInterestFunc) 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", celsiustofahrenheit) From 2f7af1dfd8af78d2fe6e6be67a3eada2543c0d41 Mon Sep 17 00:00:00 2001 From: Nitsujed Date: Mon, 19 Oct 2020 14:05:22 -0400 Subject: [PATCH 2/3] Changed deg to degrees --- mathgenerator/funcs/celsiustofahrenheit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mathgenerator/funcs/celsiustofahrenheit.py b/mathgenerator/funcs/celsiustofahrenheit.py index ec981db..fd2ca82 100644 --- a/mathgenerator/funcs/celsiustofahrenheit.py +++ b/mathgenerator/funcs/celsiustofahrenheit.py @@ -4,7 +4,7 @@ from ..__init__ import Generator def celsiustofahrenheit(maxTemp=100): celsius = random.randint(-50, maxTemp) fahrenheit = (celsius * (9/5)) +32 - problem = "Convert", str(celsius), "deg Celsius to degrees Fahrenheit =" + problem = "Convert", str(celsius), "degrees Celsius to degrees Fahrenheit =" solution = str(fahrenheit) return problem, solution From c81d89bf25c5b554fed355f9641e77c1d62e4b7a Mon Sep 17 00:00:00 2001 From: Luke Weiler Date: Mon, 19 Oct 2020 14:20:06 -0400 Subject: [PATCH 3/3] Update celsiustofahrenheit.py --- mathgenerator/funcs/celsiustofahrenheit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathgenerator/funcs/celsiustofahrenheit.py b/mathgenerator/funcs/celsiustofahrenheit.py index fd2ca82..641663f 100644 --- a/mathgenerator/funcs/celsiustofahrenheit.py +++ b/mathgenerator/funcs/celsiustofahrenheit.py @@ -1,11 +1,11 @@ from .__init__ import * from ..__init__ import Generator -def celsiustofahrenheit(maxTemp=100): +def celsiustofahrenheitFunc(maxTemp=100): celsius = random.randint(-50, maxTemp) fahrenheit = (celsius * (9/5)) +32 problem = "Convert", str(celsius), "degrees Celsius to degrees Fahrenheit =" solution = str(fahrenheit) return problem, solution -celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheit) +celsiustofahrenheit = Generator("Celsius To Fahrenheit", 81, "(C +(9/5))+32=", "F", celsiustofahrenheitFunc)