From b94a426820fdfc17ada8d5b08363e84e7a5766f8 Mon Sep 17 00:00:00 2001 From: Konate Oumonmian Ibrahim <oumonmian-ibrahim.KONATE@etu.univ-amu.fr> Date: Fri, 10 Jan 2025 15:03:08 +0100 Subject: [PATCH] Add file --- test.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test.py b/test.py index 9342eea..bf60271 100644 --- a/test.py +++ b/test.py @@ -1,5 +1,5 @@ # question 1) -import itertools as iter +import itertools as it class TabletteChocolat: def __init__(self,m,n): self.m=m @@ -15,12 +15,23 @@ class TabletteChocolat: return "Tablette Chocolat de "+ str(self.m)+"X"+str(self.n) def __repr__(self): return str(self) - def coups_possible(self): - for i,j in range(self.m, self.n): + def coups_possibles(self): + j=0 + for i in range(self.m): + if 0<i < self.m: + for j in range(self.n): + if i==0 and 0<j<self.n: + print(it.chain(range(5), range(self.m, self.m))) + + #[ iter.tuple(range(3), range(self.m,self.n)) for 0<i<self.m and j==0 ] + + t=TabletteChocolat(3, 4) t=TabletteChocolat(4, 4) +g=t.coups_possibles() +list(g) print(t) \ No newline at end of file -- GitLab