Created
January 5, 2021 08:56
-
-
Save BankNatchapol/2e0d3cc5ffe44ab2ccd4ad16cbc4430b to your computer and use it in GitHub Desktop.
Classical XOR Gate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def xor_gate(bit1, bit2): | |
assert bit1 in (0, 1) and bit2 in (0, 1), "Only 0 or 1" | |
if bit1 != bit2: | |
return 1 | |
return 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment