Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Boolean Algebra by zator55
def boolean(x, y, operation):
if operation == "conjunction":
if x==1 and y==1:
return 1
else:
return 0
elif operation == "disjunction":
if x==0 and y == 0:
return 0
else:
return 1
elif operation == "implication":
if x==1 and y==0:
return 0
else:
return 1
elif operation == "exclusive":
if x==1 and y==0:
return 1
elif x==0 and y==1:
return 1
else:
return 0
elif operation == "equivalence":
if x==0 and y==0:
return 1
elif x==1 and y==1:
return 1
else:
return 0
boolean(1, 1, "conjunction") == 1
Dec. 5, 2015