Skip to content

Instantly share code, notes, and snippets.

@BankNatchapol
Created January 5, 2021 08:56
Show Gist options
  • Save BankNatchapol/2e0d3cc5ffe44ab2ccd4ad16cbc4430b to your computer and use it in GitHub Desktop.
Save BankNatchapol/2e0d3cc5ffe44ab2ccd4ad16cbc4430b to your computer and use it in GitHub Desktop.
Classical XOR Gate
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