From e9e42a67ef8f69852857e478c5d7ba89e2149c84 Mon Sep 17 00:00:00 2001 From: Mehdi Bahou <mehdi.bahou@etu.univ-amu.fr> Date: Fri, 10 Jan 2025 14:07:21 +0100 Subject: [PATCH] Question 6 --- examen.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examen.py b/examen.py index d18ed1b..9e805e1 100644 --- a/examen.py +++ b/examen.py @@ -44,6 +44,17 @@ class TabletteChocolat: return True else: return False + def coupe(self, i, j): + """ + Doc de coupe + :param i: int nombre de ligne enlevé + :param j: int nombre de colonne enlevé + :return: TabletteChocolat + """ + if self.est_possible(i,j): + return TabletteChocolat(self.m - i, self.n - j) + else: + raise ValueError('Coup impossible') #Programme Principal Tablette = TabletteChocolat(3,4) @@ -51,3 +62,4 @@ print(Tablette) g= Tablette.coups_possibles() print(list(g)) print(Tablette.est_possible(1,0)) +biscuit = Tablette.coupe(1,0) \ No newline at end of file -- GitLab