Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
With dictionary solution in Clear category for Boolean Algebra by andreyihnatchenko
OPERATION_NAMES = ("conjunction", "disjunction", "implication", "exclusive", "equivalence")
def boolean(x, y, operation):
dict1 = {'conjunction':'x*y', 'disjunction': '1 if y+x > 0 else 0',
'implication': '1 if y >= x else 0', 'exclusive': '0 if x==y else 1',
'equivalence': '1 if x==y else 0'}
res = eval(dict1.get(operation))
return res
Feb. 28, 2020