From 927fc55ba9d6bca9cc4981f157ccd33bbbad9029 Mon Sep 17 00:00:00 2001 From: robohie Date: Fri, 9 May 2025 15:57:07 +0100 Subject: [PATCH 1/3] Update and_gate.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit J'ai nourri ce programme en ajoutant une porte And à n entrées. --- boolean_algebra/and_gate.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/boolean_algebra/and_gate.py b/boolean_algebra/and_gate.py index 6ae66b5b0a77..3991d0042c95 100644 --- a/boolean_algebra/and_gate.py +++ b/boolean_algebra/and_gate.py @@ -32,6 +32,18 @@ def and_gate(input_1: int, input_2: int) -> int: return int(input_1 and input_2) +def n_and_gate(inputs: tuple) -> int: + """ + Calcul le And de la liste des nombres + binaires fournie. Nécessaire pour + implémenter une porte And à n entrées + Par exemple + >>> n_and_gate((1, 0, 1, 1, 0)) + 0 + """ + return int(all(inputs)) + + if __name__ == "__main__": import doctest From c54f7bbc9a51f7e0b25b3f0527319da3c3aceed6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 15:07:11 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- boolean_algebra/and_gate.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boolean_algebra/and_gate.py b/boolean_algebra/and_gate.py index 3991d0042c95..9c09b7b2e219 100644 --- a/boolean_algebra/and_gate.py +++ b/boolean_algebra/and_gate.py @@ -33,15 +33,15 @@ def and_gate(input_1: int, input_2: int) -> int: def n_and_gate(inputs: tuple) -> int: - """ - Calcul le And de la liste des nombres - binaires fournie. Nécessaire pour - implémenter une porte And à n entrées - Par exemple - >>> n_and_gate((1, 0, 1, 1, 0)) - 0 - """ - return int(all(inputs)) + """ + Calcul le And de la liste des nombres + binaires fournie. Nécessaire pour + implémenter une porte And à n entrées + Par exemple + >>> n_and_gate((1, 0, 1, 1, 0)) + 0 + """ + return int(all(inputs)) if __name__ == "__main__": From 7072b86b42493909590a88989fa3cb8ca773bc8f Mon Sep 17 00:00:00 2001 From: robohie Date: Fri, 9 May 2025 16:13:00 +0100 Subject: [PATCH 3/3] Update and_gate.py Commentaires en anglais --- boolean_algebra/and_gate.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/boolean_algebra/and_gate.py b/boolean_algebra/and_gate.py index 9c09b7b2e219..58175fb0541b 100644 --- a/boolean_algebra/and_gate.py +++ b/boolean_algebra/and_gate.py @@ -34,10 +34,8 @@ def and_gate(input_1: int, input_2: int) -> int: def n_and_gate(inputs: tuple) -> int: """ - Calcul le And de la liste des nombres - binaires fournie. Nécessaire pour - implémenter une porte And à n entrées - Par exemple + Calculate AND of a list of input values + >>> n_and_gate((1, 0, 1, 1, 0)) 0 """