From ee6b88d573807838a4978eac62598b473309f3f2 Mon Sep 17 00:00:00 2001 From: BiocheH <quentin.hartman13@gmail.com> Date: Fri, 10 Jan 2025 13:26:46 +0100 Subject: [PATCH] =?UTF-8?q?q6=20:=20ajout=20de=20coupe=20(m=C3=A9thode=20d?= =?UTF-8?q?e=20TabletteChocolat)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 7baeb92..9613a1a 100644 --- a/main.py +++ b/main.py @@ -24,6 +24,9 @@ class TabletteChocolat: def est_possible(self, couple): return couple in list(self.coups_possibles()) + def coupe(self, couple): + return TabletteChocolat(self.m - couple[0], self.n - couple[1]) + A = TabletteChocolat(1, 2) B = TabletteChocolat(4, 8) @@ -31,6 +34,7 @@ print(A) print(B) print(list(B.coups_possibles())) print(B.coups_possibles()) -print(B.est_possible((3,0))) -print(B.est_possible((3,2))) - +print(B.est_possible((3, 0))) +print(B.est_possible((3, 2))) +print(B.coupe((0, 5))) +print(B.coupe((2, 0))) -- GitLab