diff --git a/examen.py b/examen.py index 082de746b8bc4f5970b8a4a4cf4a849f9c5f6362..845b042225a35d733c55cebbb30a8cab659bdc54 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