Hızlı yanıt: kod örneği
bisect_left
p
x
x
p
x
x
x
from bisect import bisect_leftdef binary_search(a, x, lo=0, hi=None): if hi is None: hi = len(a) pos = bisect_left(a, x, lo, hi) # find insertion position return pos if pos != hi and a[pos] == x else -1 # don't walk off the end