Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
if else solution in Clear category for Boolean Algebra by PawlakBartosz43
OPERATION_NAMES = ("conjunction", "disjunction", "implication", "exclusive", "equivalence")
def boolean(x, y, operation):
if(operation == OPERATION_NAMES[0]):
if(x == 1 and y == 1):
return 1
else:
return 0
else:
if(operation == OPERATION_NAMES[1]):
if(x == 0 and y == 0):
return 0
else:
return 1
else:
if(operation == OPERATION_NAMES[2]):
if(x == 1 and y == 0):
return 0
else:
return 1
else:
if(operation == OPERATION_NAMES[3]):
if(x != y):
return 1
else:
return 0
else:
if(operation == OPERATION_NAMES[4]):
if(x == y):
return 1
else:
return 0
Jan. 15, 2017