MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / xnor_gate

Function xnor_gate

boolean_algebra/xnor_gate.py:19–31  ·  view source on GitHub ↗

Calculate XOR of the input values >>> xnor_gate(0, 0) 1 >>> xnor_gate(0, 1) 0 >>> xnor_gate(1, 0) 0 >>> xnor_gate(1, 1) 1

(input_1: int, input_2: int)

Source from the content-addressed store, hash-verified

17
18
19def xnor_gate(input_1: int, input_2: int) -> int:
20 """
21 Calculate XOR of the input values
22 >>> xnor_gate(0, 0)
23 1
24 >>> xnor_gate(0, 1)
25 0
26 >>> xnor_gate(1, 0)
27 0
28 >>> xnor_gate(1, 1)
29 1
30 """
31 return 1 if input_1 == input_2 else 0
32
33
34if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected