From 0f4712e58d11dd8f81bac64c568330897c97c633 Mon Sep 17 00:00:00 2001 From: Fares_AZOUAOUI <fares.azouaoui@gmail.com> Date: Fri, 10 Jan 2025 13:42:40 +0100 Subject: [PATCH] question 6 + doctest --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9b248bd..4d95652 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ from itertools import chain + class TabletteChocolat : def __init__(self, m:int, n:int): ''' @@ -24,9 +25,12 @@ class TabletteChocolat : resultat.append(0, i) 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''' - 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]) -- GitLab