send operator by parameter python
import operator
# '>': operator.gt
# '<': operator.lt,
# '>=': operator.ge,
# '<=': operator.le,
# '=': operator.eq
get_truth(1.0, operator.gt, 0.0)
...
def get_truth(inp, relate, cut):
return relate(inp, cut)
# you don't actually need an if statement here