From 0db86b35acd6ef5dd7596f53663564df854e660a Mon Sep 17 00:00:00 2001
From: Mehdi Bahou <mehdi.bahou@etu.univ-amu.fr>
Date: Fri, 10 Jan 2025 14:47:12 +0100
Subject: [PATCH] Question 9 pas bon faut voir l'autre

---
 examen.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/examen.py b/examen.py
index 3672d32..02e9f61 100644
--- a/examen.py
+++ b/examen.py
@@ -75,11 +75,19 @@ class TabletteChocolat:
     def demander_coup(self):
         demande = input('Couper des lignes (l) ou colonnes (c) ?')
         if demande == 'l':
-            reponse = int(input("Combien ? En sachant qu'il y a " + str(self.m-1) +" possibilités"))
-            return (reponse,0)
+            while(True):
+                reponse = int(input("Combien ? En sachant qu'il y a " + str(self.m-1) +" possibilités"))
+                if 1 <= reponse < self.m -1:
+                    return (reponse,0)
+                else:
+                    print('coup non valide')
         elif demande == 'c':
-            reponse = int(input("Combien ? En sachant qu'il y a "+ str(self.n - 1)+ " possibilités"))
-            return (0, reponse)
+            while(True):
+                reponse = int(input("Combien ? En sachant qu'il y a "+ str(self.n - 1)+ " possibilités"))
+                if 1 <= reponse < self.m -1:
+                    return (0,reponse)
+                else:
+                    print('coup non valide')
 
 #Programme Principal
 
-- 
GitLab