mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Optimize and_gate and nand_gate (#10591)
* Added more optimized sudoku solver algorithm * Added more optimized sudoku solver algorithm and File Renamed * and_gate is Optimized * and_gate is Optimized * and_gate is Optimized * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
fcea18c9f0
commit
5f629b6049
|
@ -29,7 +29,7 @@ def and_gate(input_1: int, input_2: int) -> int:
|
|||
>>> and_gate(1, 1)
|
||||
1
|
||||
"""
|
||||
return int((input_1, input_2).count(0) == 0)
|
||||
return int(input_1 and input_2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -27,7 +27,7 @@ def nand_gate(input_1: int, input_2: int) -> int:
|
|||
>>> nand_gate(1, 1)
|
||||
0
|
||||
"""
|
||||
return int((input_1, input_2).count(0) != 0)
|
||||
return int(not (input_1 and input_2))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue
Block a user