Skip to content
Snippets Groups Projects
Commit c963b29e authored by Leo Litaize's avatar Leo Litaize
Browse files

Question 5; et question 2 changée

parent 1eb234eb
No related branches found
No related tags found
No related merge requests found
import matplotlib.pyplot as plt
from itertools import chain as ch from itertools import chain as ch
class TabletteChocolat: class TabletteChocolat:
def __init__(self, m, n): def __init__(self, m, n):
...@@ -6,13 +7,14 @@ class TabletteChocolat: ...@@ -6,13 +7,14 @@ class TabletteChocolat:
try: try:
self.m==int and self.n==int self.m==int and self.n==int
except : except :
raise TypeError("Rentrer des entiers") TypeError, print("Rentrer des entiers")
def __str__(self): def __str__(self):
return "("+str(self.m) + "x" + str(self.n) + ")" return "("+str(self.m) + "x" + str(self.n) + ")"
def __repr__(self): def __repr__(self):
return str(self) return "Tablette de chocolat de "+ str(self.n) + "x" + str(self.m) + ")"
def coups_possibles(self): def coups_possibles(self):
for i in range(self.m): for i in range(self.m):
for j in range(self.n): for j in range(self.n):
...@@ -23,7 +25,6 @@ class TabletteChocolat: ...@@ -23,7 +25,6 @@ class TabletteChocolat:
#return itertools.chain ?????? #return itertools.chain ??????
#help(itertools.chain) ?????? #help(itertools.chain) ??????
def est_possible(self, i, j): def est_possible(self, i, j):
for a in list(g): for a in list(g):
if a==(i,j): if a==(i,j):
...@@ -31,6 +32,7 @@ class TabletteChocolat: ...@@ -31,6 +32,7 @@ class TabletteChocolat:
else: else:
return "Ce coup n est pas possible" return "Ce coup n est pas possible"
#def coupe(self,i,j):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment