diff --git a/examen.py b/examen.py index e6afb2e1c55602c90a84be2397c8c7509d871eab..7e5a04e6fb5cce309db1bfe09d6447d1f9387622 100644 --- a/examen.py +++ b/examen.py @@ -1,6 +1,6 @@ #Imports éventuels import itertools as it - +import matplotlib as plt #AJouts de fonctions et méthode @@ -17,18 +17,25 @@ class TabletteChocolat:#création de la classe return "Tablette de chocolat de"+str(self.m)+"x"+str(self.n) def coups_possibles(self): + h=() g=[] - for i in range(self.m): - for j in range(self.n): - g.append((i,j)) - return g + for h in it.chain(range(self.m),range(self.n)): + g.append(h) + return def est_possible(self,i,j): if isinstance((i,j),self.coups_possibles()): return True + + def coupe(self,i,j): + return self.coups_possibles() + + + + #Programme principal -#if __name__=='main': -t = TabletteChocolat(3,4) -g = t.coups_possibles() -print(t) -print(g) \ No newline at end of file +if True: # __name__=='main': + t = TabletteChocolat(3,4) + g = t.coups_possibles() + print(t) + print(g) \ No newline at end of file