diff --git a/main.py b/main.py index ad729349ffc0e25a5b2e884d810ba847a7f07574..98aa96445279fba2903f34f0f0b9642eeac00ba1 100644 --- a/main.py +++ b/main.py @@ -1,15 +1,27 @@ +from itertools import chain + class TabletteChocolat: def __init__(self, m, n): self.m=m self.n=n - def typage(self,m,n): - try: - assert (self.m==int(self.m) and self.n==int(self.n)) - except: - return(ValueError) + def typage(self): + if self.m==int(self.m) and self.n==int(self.n): + pass + else: + return('Erreur') def __str__(self): return('Tablette de chocolat de ' + str(self.m) + 'x' + str(self.n)) + def coups_possibles(self): + g=[] + for i in range(1,self.m): + g.append((i,0)) + for j in range(1,self.n): + g.append((0,j)) + return g + + -T1=TabletteChocolat(1,2) +T1=TabletteChocolat(3,4) T2=TabletteChocolat(1.5,7) +g = T1.coups_possibles() \ No newline at end of file