From eb302b8e1659929910ee23264df8143d8c96bcad Mon Sep 17 00:00:00 2001 From: Mamadu Lamarana Bah <mamadulamarana.bah.etu@univ-lille.fr> Date: Thu, 18 Jan 2024 11:29:19 +0100 Subject: [PATCH] refact --- src/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.py b/src/util.py index 2bac69f..c2d9bf7 100644 --- a/src/util.py +++ b/src/util.py @@ -49,7 +49,7 @@ def recherche_dichotomique(x, l, cmp = compare): """ # précondition : liste triée assert all(l[k] <= l[k+1] for k in range(len(l) - 1)) - # votre code ici sans le return + taille = len(l) debut, fin = 0, taille index = 0 @@ -63,11 +63,11 @@ def recherche_dichotomique(x, l, cmp = compare): else: fin = milieu index = milieu + # postcondition assert 0 <= index <= len(l) assert all(j < index and l[j] < x or l[j] >= x for j in range(len(l))) - # retour return (False, index) ## LOIC -- GitLab