BISECT_LEFT IN PYTHON
import bisect
'''
bisect_left finds and returns the index where an element can be inserted
and still maintain sorted order of the list
'''
#5,6,7,
arr = [1,2,3,4, 8,9,10]
#Index:0,1,2,3,4 ,5,6
x = 5
ans = bisect.bisect_left(arr, x)
print(ans) # 4
arr = [0,1,2,3,4,5,5,8,9,10]
#Index:0,1,2,3,4,5,6,7,8
x = 5
ans = bisect.bisect_left(arr, x)
print(ans) # 5
Christian Antony Quero