mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 14:35:23 +01:00
Added a generator signum function..
This commit is contained in:
25
mathgenerator/funcs/signumFunc.py
Normal file
25
mathgenerator/funcs/signumFunc.py
Normal 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user