From bd4e4b93c77a7aa456282341accb7fbb1929af23 Mon Sep 17 00:00:00 2001 From: g20009442 <maelis.guyot@etu.univ-amu.fr> Date: Fri, 10 Jan 2025 14:50:01 +0100 Subject: [PATCH] =?UTF-8?q?enfin=20r=C3=A9ussi=20=C3=A0=20faire=20la=20q.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examen.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examen.py b/examen.py index 082de74..845b042 100644 --- a/examen.py +++ b/examen.py @@ -16,8 +16,14 @@ class TabletteChocolat:#création de la classe def __repr__(self): #surcharge de repr return "Tablette de chocolat de"+str(self.m)+"x"+str(self.n) - def coups_possibles(self): - return it.chain((i,0) for i in range(self.m)),(0,j) for j in range(self.n) + def coups_possibles(self):# + g=[] + h=[] + for j in range(1,self.n): + g.append((0,j)) + for i in range(1,self.m): + h.append((i,0)) + return it.chain(h,g) def est_possible(self,i,j): @@ -61,4 +67,4 @@ if True: # __name__=='main': t = TabletteChocolat(3,4) g = t.coups_possibles() print(t) - print(g) \ No newline at end of file + print(list(g)) \ No newline at end of file -- GitLab