Skip to content

Commit 8ec32ab

Browse files
committed
fix: enforce input length restriction in n_input_nand_gate function
1 parent fd24874 commit 8ec32ab

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

boolean_algebra/nand_gate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def n_input_nand_gate(inputs: list[int]) -> int:
4242
>>> n_input_nand_gate([1, 0, 0, 0, 0])
4343
1
4444
"""
45+
46+
if len(inputs) > 2:
47+
raise ValueError("Input list must contain at most two elements")
48+
4549
return int(not all(inputs))
4650

4751

0 commit comments

Comments
 (0)