Skip to content
Snippets Groups Projects
Commit bd4e4b93 authored by GUYOT Maelis's avatar GUYOT Maelis
Browse files

enfin réussi à faire la q.4

parent f5fce45e
No related branches found
No related tags found
No related merge requests found
...@@ -16,8 +16,14 @@ class TabletteChocolat:#création de la classe ...@@ -16,8 +16,14 @@ class TabletteChocolat:#création de la classe
def __repr__(self): #surcharge de repr def __repr__(self): #surcharge de repr
return "Tablette de chocolat de"+str(self.m)+"x"+str(self.n) return "Tablette de chocolat de"+str(self.m)+"x"+str(self.n)
def coups_possibles(self): def coups_possibles(self):#
return it.chain((i,0) for i in range(self.m)),(0,j) for j in range(self.n) 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): def est_possible(self,i,j):
...@@ -61,4 +67,4 @@ if True: # __name__=='main': ...@@ -61,4 +67,4 @@ if True: # __name__=='main':
t = TabletteChocolat(3,4) t = TabletteChocolat(3,4)
g = t.coups_possibles() g = t.coups_possibles()
print(t) print(t)
print(g) print(list(g))
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment