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

Function or_gate

boolean_algebra/or_gate.py:17–29  ·  view source on GitHub ↗

Calculate OR of the input values >>> or_gate(0, 0) 0 >>> or_gate(0, 1) 1 >>> or_gate(1, 0) 1 >>> or_gate(1, 1) 1

(input_1: int, input_2: int)

Source from the content-addressed store, hash-verified

15
16
17def or_gate(input_1: int, input_2: int) -> int:
18 """
19 Calculate OR of the input values
20 >>> or_gate(0, 0)
21 0
22 >>> or_gate(0, 1)
23 1
24 >>> or_gate(1, 0)
25 1
26 >>> or_gate(1, 1)
27 1
28 """
29 return int((input_1, input_2).count(1) != 0)
30
31
32if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

countMethod · 0.80

Tested by

no test coverage detected