Added a generator signum function..

This commit is contained in:
Gautam Prasad
2020-10-24 05:01:47 +05:30
committed by GitHub
parent 5ffa50b1f3
commit 0e3e182934

View File

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