Evaluate the overengineered XOR gate. By Benji '24
def XOR(bool1, bool2):
value1 = bool1 or bool2
value2 = not (bool1 and bool2)
return value1 and value2
Function Call | Return Value | |||
---|---|---|---|---|
XOR(False, False) | → | |||
XOR(False, True) | → | |||
XOR(True, False) | → | |||
XOR(True, True) | → |
Experiment with this code on Gitpod.io