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