Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Boolean Algebra by RobertCocking
OPERATION_NAMES = ("conjunction", "disjunction", "implication", "exclusive", "equivalence")
def boolean(x, y, operation):
if x and y:
return operation != "exclusive"
elif x == 0 and y == 0:
return operation == "implication" or operation == "equivalence"
elif x:
return operation == "disjunction" or operation == "exclusive"
else:
return operation != "conjunction" and operation != "equivalence"
May 3, 2020