Skip to content
Snippets Groups Projects
Commit 0f4712e5 authored by Fares_AZOUAOUI's avatar Fares_AZOUAOUI
Browse files

question 6 + doctest

parent 91cfddea
No related branches found
No related tags found
No related merge requests found
from itertools import chain from itertools import chain
class TabletteChocolat : class TabletteChocolat :
def __init__(self, m:int, n:int): def __init__(self, m:int, n:int):
''' '''
...@@ -24,9 +25,12 @@ class TabletteChocolat : ...@@ -24,9 +25,12 @@ class TabletteChocolat :
resultat.append(0, i) resultat.append(0, i)
return chain(resultat) return chain(resultat)
def est_possible(self, i, j) : def est_possible(self, couple_i_j) :
'''cette méthode prend en paramètres un couple i et j, les coordonées du carreau, et revoie si le coup en ces coordonnées est possible''' '''cette méthode prend en paramètres un couple i et j, les coordonées du carreau, et revoie si le coup en ces coordonnées est possible'''
return couple in list(self.coups_possibles()) return couple_i_j in list(self.coups_possibles())
def coupe(self, couple_i_j) :
return TabletteChocolat(self.m - couple_i_j[0] , self.n - couple_i_j[1])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment