Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Boolean Algebra by new_hoschi
OPERATION_NAMES = ("conjunction", "disjunction", "implication", "exclusive", "equivalence")
''' Simply evaluate the string which tells you the operation to be applied.
Every logical operation gets its own method and hence is called by boolean.
'''
def boolean(x, y, operation):
return eval(operation)(x,y)
def conjunction(x,y):
return x and y
def disjunction(x,y):
return x or y
def implication(x,y):
return not x or y
def exclusive(x,y):
return (x or y) and not (x and y)
def equivalence(x,y):
return x==y
April 26, 2021