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

Function imply_gate

boolean_algebra/imply_gate.py:20–33  ·  view source on GitHub ↗

Calculate IMPLY of the input values >>> imply_gate(0, 0) 1 >>> imply_gate(0, 1) 1 >>> imply_gate(1, 0) 0 >>> imply_gate(1, 1) 1

(input_1: int, input_2: int)

Source from the content-addressed store, hash-verified

18
19
20def imply_gate(input_1: int, input_2: int) -> int:
21 """
22 Calculate IMPLY of the input values
23
24 >>> imply_gate(0, 0)
25 1
26 >>> imply_gate(0, 1)
27 1
28 >>> imply_gate(1, 0)
29 0
30 >>> imply_gate(1, 1)
31 1
32 """
33 return int(input_1 == 0 or input_2 == 1)
34
35
36def recursive_imply_list(input_list: list[int]) -> int:

Callers 1

recursive_imply_listFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected