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] 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) + + + + + + +