Skip to content
Snippets Groups Projects
Commit eb302b8e authored by Mamadu-lamarana Bah's avatar Mamadu-lamarana Bah :speech_balloon:
Browse files

refact

parent 523b301c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment