Skip to content
Snippets Groups Projects
Commit 1f312b6a authored by VILLA Jonathan's avatar VILLA Jonathan
Browse files

question 4 14h20

parent 60f83544
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment