PyDocs

Nav

Data Types

bisect_right

bisect

function
  • bisect_right(a, x, lo=0, hi=len(a), *, key=None)
Return the index where to insert item x in list a, assuming a is sorted.

The return value i is such that all e in a[:i] have e <= x, and all e in
a[i:] have e > x.  So if x already appears in the list, a.insert(i, x)
will insert just after the rightmost x already there.

Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.

A custom key function can be supplied to customize the sort order.
Changed in 3.10
  • 3.10: Added the key parameter.
0 Examples
No examples for bisect/bisect_right.
See Also
No see-alsos for bisect/bisect_right
0 Notes
No notes for bisect_right