From 0e3e1829348ed8026231d249e021466963a3828c Mon Sep 17 00:00:00 2001 From: Gautam Prasad <70034446+Gautampd73@users.noreply.github.com> Date: Sat, 24 Oct 2020 05:01:47 +0530 Subject: [PATCH 1/5] Added a generator signum function.. --- mathgenerator/funcs/signumFunc.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 mathgenerator/funcs/signumFunc.py diff --git a/mathgenerator/funcs/signumFunc.py b/mathgenerator/funcs/signumFunc.py new file mode 100644 index 0000000..962924c --- /dev/null +++ b/mathgenerator/funcs/signumFunc.py @@ -0,0 +1,25 @@ +import random + + +def signumFunc(min=-999,max=999): + + a = random.randint(min,max) + b = 0 + if (a>0): + b = 1 + if (a<0): + b = -1 + problem = "signum of " + str(a) + " is " + "=" + solution = str(b) + return problem, solution + +signum_function = Generator("signum function", 106, + "signum function of a is ", "b" , + signumFunc) + + + + + + + From 73089e6523ddb2dcecd87af78fae8605b1034b04 Mon Sep 17 00:00:00 2001 From: Gautam Prasad <70034446+Gautampd73@users.noreply.github.com> Date: Sat, 24 Oct 2020 05:06:37 +0530 Subject: [PATCH 2/5] Update __init__.py --- mathgenerator/funcs/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mathgenerator/funcs/__init__.py b/mathgenerator/funcs/__init__.py index 575dcd2..c49269f 100644 --- a/mathgenerator/funcs/__init__.py +++ b/mathgenerator/funcs/__init__.py @@ -111,3 +111,4 @@ from .decimal_to_bcd import * from .circumference import * from .combine_like_terms import * from .conditional_probability import * +from .signum_function import * From db7508ded274a928bc9327e315ef47f8903e78f8 Mon Sep 17 00:00:00 2001 From: Gautam Prasad <70034446+Gautampd73@users.noreply.github.com> Date: Sat, 24 Oct 2020 06:03:44 +0530 Subject: [PATCH 3/5] Update signumFunc.py --- mathgenerator/funcs/signumFunc.py | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/mathgenerator/funcs/signumFunc.py b/mathgenerator/funcs/signumFunc.py index 962924c..64400e0 100644 --- a/mathgenerator/funcs/signumFunc.py +++ b/mathgenerator/funcs/signumFunc.py @@ -1,25 +1,19 @@ +from .__init__ import * import random -def signumFunc(min=-999,max=999): - - a = random.randint(min,max) +def signumFunc(min=-999, max=999): + a = random.randint(min, max) b = 0 - if (a>0): - b = 1 - if (a<0): - b = -1 + if (a > 0): + b = 1 + if (a < 0): + b = -1 problem = "signum of " + str(a) + " is " + "=" solution = str(b) return problem, solution - + + signum_function = Generator("signum function", 106, - "signum function of a is ", "b" , - signumFunc) - - - - - - - + "signum function of a is", "b", + signumFunc) From 5217590f285009bdaadc52cc74448aa93214391c Mon Sep 17 00:00:00 2001 From: Gautam Prasad <70034446+Gautampd73@users.noreply.github.com> Date: Sat, 24 Oct 2020 06:07:40 +0530 Subject: [PATCH 4/5] Delete signumFunc.py --- mathgenerator/funcs/signumFunc.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 mathgenerator/funcs/signumFunc.py diff --git a/mathgenerator/funcs/signumFunc.py b/mathgenerator/funcs/signumFunc.py deleted file mode 100644 index 64400e0..0000000 --- a/mathgenerator/funcs/signumFunc.py +++ /dev/null @@ -1,19 +0,0 @@ -from .__init__ import * -import random - - -def signumFunc(min=-999, max=999): - a = random.randint(min, max) - b = 0 - if (a > 0): - b = 1 - if (a < 0): - b = -1 - problem = "signum of " + str(a) + " is " + "=" - solution = str(b) - return problem, solution - - -signum_function = Generator("signum function", 106, - "signum function of a is", "b", - signumFunc) From 1235b4c424ccc111d271e6d61cc4a64779190bcc Mon Sep 17 00:00:00 2001 From: Gautam Prasad <70034446+Gautampd73@users.noreply.github.com> Date: Sat, 24 Oct 2020 06:08:28 +0530 Subject: [PATCH 5/5] Create signum_function.py --- mathgenerator/funcs/signum_function.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 mathgenerator/funcs/signum_function.py diff --git a/mathgenerator/funcs/signum_function.py b/mathgenerator/funcs/signum_function.py new file mode 100644 index 0000000..64400e0 --- /dev/null +++ b/mathgenerator/funcs/signum_function.py @@ -0,0 +1,19 @@ +from .__init__ import * +import random + + +def signumFunc(min=-999, max=999): + a = random.randint(min, max) + b = 0 + if (a > 0): + b = 1 + if (a < 0): + b = -1 + problem = "signum of " + str(a) + " is " + "=" + solution = str(b) + return problem, solution + + +signum_function = Generator("signum function", 106, + "signum function of a is", "b", + signumFunc)