Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Boolean Algebra by jacekgrycza
O= ("conjunction", "disjunction", "implication", "exclusive", "equivalence")
def boolean(x, y, op):
if op==O[0]:
return x*y
if op==O[1]:
if x+y==0:
return 0
return 1
if op==O[2]:
if x==1 and y==0:
return 0
return 1
if op==O[3]:
if (x+y)%2==0:
return 0
return 1
if op==O[4]:
if x==y:
return 1
return 0
Nov. 5, 2016